Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

milestone 1 #162

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Abhishek jha/Number-pattern1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include<iostream>
using namespace std;
int main()
{
int i,j;
for ( i = 1; i < 7; i++)
{
cout<<endl;
for ( j = 1; j < i; j++)
{
cout<<j;
}

}

}
Binary file added Abhishek jha/Number-pattern1.exe
Binary file not shown.
15 changes: 15 additions & 0 deletions Abhishek jha/Number-pattern13.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<iostream>
using namespace std;
int main()
{
int i, j;
for ( i = 5; i >=1 ; i--)
{
for ( j = 1; j <= i; j++)
{
cout<<i;
}
cout<<endl;
}
return 0;
}
Binary file added Abhishek jha/Number-pattern13.exe
Binary file not shown.
15 changes: 15 additions & 0 deletions Abhishek jha/Number-pattern2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<iostream>
using namespace std;
int main()
{
int i, j;
for ( i = 5; i >= 1; i--)
{
for ( j = i; j <= 5; j++)
{
cout<<j;
}
cout<<endl;
}
return 0;
}
Binary file added Abhishek jha/Number-pattern2.exe
Binary file not shown.
15 changes: 15 additions & 0 deletions Abhishek jha/Number-pattern3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<iostream>
using namespace std;
int main()
{
int i, j;
for ( i = 5; i >=1 ; i--)
{
for ( j = 1; j <= i; j++)
{
cout<<j;
}
cout<<endl;
}
return 0;
}
Binary file added Abhishek jha/Number-pattern3.exe
Binary file not shown.
15 changes: 15 additions & 0 deletions Abhishek jha/Number-pattern4.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<iostream>
using namespace std;
int main()
{
int i, j;
for ( i = 1; i <=5 ; i++)
{
for ( j = i; j <= 5; j++)
{
cout<<j;
}
cout<<endl;
}
return 0;
}
Binary file added Abhishek jha/Number-pattern4.exe
Binary file not shown.
15 changes: 15 additions & 0 deletions Abhishek jha/Number-pattern5.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<iostream>
using namespace std;
int main()
{
int i, j;
for ( i = 5; i >=1 ; i--)
{
for ( j = i; j >=1; j--)
{
cout<<j;
}
cout<<endl;
}
return 0;
}
Binary file added Abhishek jha/Number-pattern5.exe
Binary file not shown.
15 changes: 15 additions & 0 deletions Abhishek jha/Number-pattern6.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<iostream>
using namespace std;
int main()
{
int i, j;
for ( i = 1; i <=5 ; i++)
{
for ( j = 5; j >=i; j--)
{
cout<<j;
}
cout<<endl;
}
return 0;
}
Binary file added Abhishek jha/Number-pattern6.exe
Binary file not shown.
15 changes: 15 additions & 0 deletions Abhishek jha/Untitled1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<iostream>
using namespace std;
int main()
{
int i,j;
for(i=0;i<=4;i++)
{
cout<<endl;
for(j=0;j<i;j++)
{
cout<<"*"<<" ";
}
}

}
Binary file added Abhishek jha/Untitled1.exe
Binary file not shown.
16 changes: 16 additions & 0 deletions Abhishek jha/even or odd.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include<iostream>
using namespace std;
int main()
{
int a;
cout<<"enter the number"<<endl;
cin>>a;
if(a/2==0)
{
cout<<"number is even";

}
else
cout<<"number is odd";
return 0;
}
18 changes: 18 additions & 0 deletions Abhishek jha/function1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include<iostream>
using namespace std;
int Sum()
{
int a,b,sum=0;
cout<<"Enter the first number:"<<endl;
cin>>a;
cout<<"Enter the second number:"<<endl;
cin>>b;
sum=a+b;
return sum;
}
int main()
{
int X;
X=Sum();
cout<<X;
}
Binary file added Abhishek jha/function1.exe
Binary file not shown.
20 changes: 20 additions & 0 deletions Abhishek jha/function2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<iostream>
using namespace std;
int factorial()
{
int n,X=1;
cout<<"Enter the number";
cin>>n;
for (int i = 1; i <= n; i++)
{
X=X*i;
}
return X;
}
int main()
{
int F=0;
F=factorial();
cout<<F;

}
Binary file added Abhishek jha/function2.exe
Binary file not shown.
23 changes: 23 additions & 0 deletions Abhishek jha/function3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include<iostream>
using namespace std;
int prime()
{
int n;
cout<<"enter the number";
cin>>n;
for (int i = 1; i <= n; i++)
{
if (n%i==0)
{
cout<<i<<endl;

}

}

};
int main()
{
prime();

}
Binary file added Abhishek jha/function3.exe
Binary file not shown.
30 changes: 30 additions & 0 deletions Abhishek jha/function4.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include<iostream>
using namespace std;
void perfectnum()
{

for (int i = 1; i <= 100; i++)
{
int n=0;
for (int j = 1; j != i; j++)
{
if (i%j == 0)
{
n=n+j;
}

}
if (n==i)
{
cout<<n<<" is perfect number"<<endl;
}


}

};
int main()
{
perfectnum();

}
Binary file added Abhishek jha/function4.exe
Binary file not shown.
25 changes: 25 additions & 0 deletions Abhishek jha/function5.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include<iostream>
using namespace std;
int power(int a,int b)
{

if (b==1)
{
return a;
}
else
{
return(a*power(a,b-1));
}

};
int main()
{
int t,v;
cout<<"Enter a and b:"<<endl;
cin>>t;
cin>>v;
int x;
x=power(t,v);
cout<<x;
}
Binary file added Abhishek jha/function5.exe
Binary file not shown.
23 changes: 23 additions & 0 deletions Abhishek jha/function6.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>
using namespace std;
int fibb(int n){
if (n==0)
{
return 0;
}
else if (n==1)
{
return 1;
}
else
{
return fibb(n-1)+fibb(n-2);
}


};
int main()
{
cout<<fibb(5);
return 0;
}
Binary file added Abhishek jha/function6.exe
Binary file not shown.
46 changes: 46 additions & 0 deletions Abhishek jha/function7.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <iostream>
using namespace std;
int taxCalculator(int gs,int ts)
{
int ti,tax;
if (ts>100000)
{
ti=gs-100000;
}
else
{
ti=gs-ts;
}


if (ti<=100000)
{
tax=0;
}

else if (ti>100000 && ti<=200000)
{
tax=(ti-100000)/10;
}

else if (ti>200000 && ti<=500000)
{
tax=((ti-100000)/10)+((ti-200000)/20);
}

else
{
tax=((ti-100000)/10)+((ti-200000)/20)+((ti-500000)/30);
}

return tax;

};
int main()
{
int gs,ts;
cin>>gs;
cin>>ts;
cout<<taxCalculator(gs,ts);
return 0;
}
Binary file added Abhishek jha/function7.exe
Binary file not shown.
28 changes: 28 additions & 0 deletions Abhishek jha/function8.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <iostream>
using namespace std;
int findage(int curr_date,int curr_mon,int curr_year,int birth_date,int birth_mon,int birth_year)
{
for (int i = birth_year; i < curr_year; i++)
{
/* code */
if (i%400==0)
{
int mon[]={31,29,31,30,31,30,31,31,30,31,30,31};
}
else if (i%100==0)
{
int mon[]={31,28,31,30,31,30,31,31,30,31,30,31};
}
else if (i%4==0)
{
int mon[]={31,29,31,30,31,30,31,31,30,31,30,31};
}
else
{
int mon[]={31,28,31,30,31,30,31,31,30,31,30,31};
}



}
}
Loading