You are on page 1of 31

SUBMITED TO:- SUBMITED BY:-

Mr.PANKAJ ……… PRIYA DUBEY


Roll. No.: - 0917EC071077
/* A PROGRAM FOR ADDITION,MULTIPLICATION
SUBTRECTION AND DIVISION FOR
GIVEN NUMBER */
#include<iostream.h>
#include<conio.h>
void main()
{
int ch;
float a,b,res;
cout<<"1\nADDITION:";
cout<<"2\nSUBTRACTION:";
cout<<"3\nMULTIPLICATION:";
cout<<"4\nDIVISION:";
cout<<"enter the ch: ";
cin>>ch;
cout<<"enter the two number:";
cin>>a>>b;
if(ch==1)
{
res=a+b;
cout<<"addition is:"<<res;
}
if(ch==2)
{
res=a-b;
cout<<"subtraction is:"<<res;
}
if(ch==3)
{
res=a*b;
cout<<"multiplication is:"<<res;
}
if(ch==4)
{
res=a/b;
cout<<"division is:"<<res;
}
getch();
}
output

1.addition
2.subtraction
3.multiplication
4.divition
Enter the ch:1
Enter two number:56
34
addition is:90
ennter the ch: 1
enter two number 8
4
addition is: 12
/* WRITE A PROGRAM TO FIND OUT SIMPLE INTEREST */

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float p,r,t,SI;
cout<<"enter the principal value";
cin>>p;
cout<<"enter the rate";
cin>>r;
cout<<"enter the time";
cin>>t;
SI=p*r*t/100;
cout<<"simple intrest is:"<<SI;
getch();
}
output
enter the principal value:55
enter the rate:3
enter the time:5
simple intrest is:8.25
/*A PROGRAM TO FIND LARGEST NO. OF 3 NUMBERS*/

#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c,d;
clrscr();
cout<<"enter 1st number";
cin>>a;
cout<<"enter 2nd number";
cin>>b;
cout<<"enter 3rd number";
cin>>c;
if(a>b&&a>c)
{
cout<<"the 1st number is greatest";
}
else if(b>a&&b>c)
{
cout<<"the 2nd number is greatest";
}
else
{
cout<<"the 3rd number is greatest";
}
getch();
}
output
enter 1st number66
enter 2nd number23
enter 3rd number88
the 3rd number is greatest
/*PROGRAM TO DETERMINE IF THE YEAR IS LEAP OR NOT*/

#include<iostream.h>
#include<conio.h>
void main()
{
int s;
cout<<"enter the year";
cin>>s;
if(s%4==0)
{
cout<<"the year is leap year";
}
else
cout<<"it is not a leap year";
getch();
}
output
enter year:2008
it is a leap year
enter year:2009
it is a not leap year
/*A PROGRAM TO CHECK IF A NUMBER IS EVEN OR ODD*/

#include<iostream.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
cout<<"enter any number";
cin>>a;
b=a%2;
if(b==0)
{
cout<<"the number is even";
}
else
{
cout<<"the number is odd";
}
getch();
}
output
enter any number34
the number is even
enter any number25
the number is odd
/*PROGRAM TO PRINT FABONACCI SERIES*/
#include<iostream.h>
#include<conio.h>
void main();
{
int a=0,b=1,c,d,e;
cout<<"enter the limit you want";
cin>>e;
cout<<a;
cout<<b;
for(d=0;d<e;d++)
{
c=a+b;
a=b;
b=c;
cout<<c;
getch();
}
}
output
enter the limit you want9
01123581321
/*PROGRAM TO PRINT THE TABLE OF INPUT NUMBER*/

#include<iostream.h>
#include<conio.h>
void main()
{
int i=1,n,t;
cout<<"enter the number:";
cin>>n;
xyz:
t=i*n;
cout<<t;
i=i+1;
if(i<=10)
{
goto xyz;
}
getch();
}
output
enter the number:19
1938577695114133152171190
/* A PROGRAM TO FIND FACTORIAL OF GIVEN NUMBERS*/
#include<iostream.h>
#include<conio.h>
void main()
{
int n,f=1;
cout<<"enter the number:";
cin>>n;
while (n>=1)
{
f=f*n;
n=n-1;
}
cout<<"the factorial is:"<<f;
getch();
}
output
enter the number:4
the factorial is:24
/* A PROGRAM TO CALCULATE TO REVERSE A GIVEN
NUMBER*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,s;
cout<<"enter the number:";
cin>>n;
while (n>0)
{
s=n%10;
cout<<s;
n=n/10;
}
getch();
}
output
enter the number :345
543
/* A PROGRAM TO GIVEN NUMBER IS PRIME OR NOT*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num,i;
cout<<"\nEnter the number:";
cin>>num;
for(i=2;i<=num/2;++i)
if (num%i==0)
cout<<"\n not a prime number:";
else
cout<<"\n it is a prime number:";
getch();
}
output
enter the number:5
it is a prime number
Enter the number :6
It is a Not Prime number
/* A PROGRAM TO PRINT THE SUM OF NUMBER UP TO 100*/

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int sum=0,n,i;
cout<<"Enter the number:";
cin>>n;
for(i=1;i<=n;i++)
{
sum=sum+i;
}
cout<<"sum is:"<<sum;
getch();
}
output
Enter the number :100
sum is :5050
/* A PROGRAM TO CALCULATE CROSS SALARY OF EMPLOYEE
WHOSE DA 70% & HRA20%
FOR BASIC SALARY*/

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int basic;
float da,hra,net;
cout<<"Enter basic salary:";
cin>>basic;
if(basic<10000)
{
da=basic*(70/100);
cout<<"\n";
hra=basic*20/100;
cout<<"\n";
net=basic+da+hra;
cout<<"net salary:"<<net;
}
getch();

}
output
enter the basic salary:8000
net salary:8289
/* A PROGRAM TO CALULATE THE % OF STUDENT & PRINT
THE DIVISION*/

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float che,bee,be,m1,cs,ed,t,p;
cout<<"Enter CHEMISTRY marks:";
cin>>che;
cout<<"Enter BASIC ELECTRCAL ENGG marks:";
cin>>bee;
cout<<"Enter BASIC ELECTRONICS marks:";
cin>>be;
cout<<"Enter MATHS1 marks:";
cin>>m1;
cout<<"Enter COMMUNICATION SKILL marks:";
cin>>cs;
cout<<"Enter ENGG. DRAWING marks:";
cin>>ed;
t=che+bee+be+m1+cs+ed;
p=(t/600)*100;
cout<<"total is:"<<t;
cout<<"\n";
cout<<"percent is:"<<p;
getch();
}
output
Enter CHEMISTRY marks:89
Enter BASIC ELECTRICAL ENGG marks:90
enter BASIC ELECTRONICS marks:94
enter METHS1 marks:100
enter COMMUNICATION SKILL marks:88
enter ENGG.DRAWING marks:87
total is:548
percent is :91.33
/* A PROGRAM TO CALCULATE THE AREA OF CICLE*/

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a,r;
cout<<"Enter the value of radius:";
cin>>r;
a=(3.14*r*r);
cout<<"the area is:"<<a;
getch();
}
output
Enter the value of redius:8
the area is :200.96
/* A PROGRAM TO CALCULATE THE AREA AND PERAMETER OF
TRIANGLE*/

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a, b, h,s,p;
cout<<"Enter the base:";
cin>>b;
cout<<"Enter the height:";
cin>>h;
cout<<"Enter the side:";
cin>>s;
a=(b*h)/2;
cout<<"The area of triangle is:"<<a;
p=b+h+s;
cout<<"The perameter of triangle is:"<<p;

getch();
}
output
enter the base :34
enter the height:22
enter the side:31
the area of triangle is :374
the perameter of triangle is:87

You might also like