Sie sind auf Seite 1von 6

#include<iostream.

h>
#include<conio.h>
void main()
{
clrscr();
cout<<"My first program";
getch();
}
--------------------------------------------------------------------------------------------------------------#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
double volt,resist,current;
cout<<"Enter Voltage of circuit: ";
cin>>volt;
cout<<"\nEnter Resistance of circuit: ";
cin>>resist;
current=volt/resist;
cout<<"\nThe required current is: "<<current;
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
cout<<"My name is Neehal Taneja.";
cout<<"\nMy address is : F-19\n\t\tkirti nagar\n\t\tnew delhi\n\t\t110015";
getch();
}
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
double x,y,z,p,n,rate,time,si,ci; /*here p:principal amount,,si: simple interest,,
ci:compound interest*/
cout<<"Enter principal amount: ";
cin>>p;
cout<<"\nEnter rate: ";
cin>>rate;
cout<<"\nEnter time: ";
cin>>time;
cout<<"\nEnter number of times the interest is compunded every year: ";
cin>>n;
si=(p*rate*time)/100;

cout<<"\nThe simple interest is: "<<si;


x=(1+rate/n);
z=n*time;
y=pow(x,z);
ci=p*y;
cout<<"\ncompund interest is : "<<ci;
getch();
}
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
double x,y,n;
cout<<"Enter a base: ";
cin>>x;
cout<<"\nEnter a positive power: ";
cin>>n;
y=pow(x,n);
cout<<"\nThe required expression is: "<<y;
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
double p,t,si;
cout<<"Enter principal amount: ";
cin>>p;
cout<<"Enter time: ";
cin>>t;
if(t>=10)
{si=p*8*t;
cout<<"\nSimple interest:"<<si; }
if(t<10)
{ si=p*12*t;
cout<<"\nSimple interest: "<<si;}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int num,x,y,rem;
cout<<"Enter a number: ";
cin>>num;

rem=num%2;
if(rem==0)
{ x=pow(num,2);
cout<<"The number is even and its square is: "<<x;
}
if(rem!=0)
{ y=pow(num,3);
cout<<"The number is odd and its cube is: "<<y;
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
double a,b,c,x,y,D;
cout<<"The quadratic equation is: ax^2 + bx + c = 0 .";
cout<<"\nEnter value for a: ";
cin>>a;
cout<<"\nEnter value for b: ";
cin>>b;
cout<<"\nEnter value for c: ";
cin>>c;
D=(b*b)-4*(a*c);
x=(-b + sqrt(D))/2*a;
y=(-b - sqrt(D))/2*a;
cout<<"\nThe roots of quadratic equation are: "<<y;
cout<<" and "<<x;
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
double r,area,peri,choice;
cout<<"Enter radius of circle(in cms.) : ";
cin>>r;
cout<<"Enter choice (1or2) : ";
cin>>choice;
if(choice==1)
{ area=(3.141592653589793)*r*r;
cout<<"The area of circle is: "<<area;
}
if(choice==2)
{ peri=2*(3.141592653589793)*r;
cout<<"The perimeter of circle is: "<<peri;
}

if(choice!=1 && choice!=2)


{ cout<<"You entered incorrect choice.";
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
void main()
{
clrscr();
char ch;
cout<<"\nEnter a character: ";
cin>>ch;
if(isalpha(ch))
{
if(islower(ch))
{ cout<<"\nThe upper case character corresponding to this is: ";
putchar(toupper(ch));
}
if(isupper(ch))
{ cout<<"\nThe lower case character corresponding to this is: ";
putchar(tolower(ch));
}
}
else
{ cout<<"\nThe character entered is not an alphabet.";
}
getch();
}
#include<iostream.h>
#include<conio.h>
#include<process.h>
void main()
{
clrscr();
int choice,ch,tsa,vol,choice2,ch2,cube,cuboid,sphere,side,l,b,h,l2,b2,h2,r,radius;
cout<<"\t\t\t\t\tMenu";
cout<<"\n1.Total surface area";
cout<<"\n2.Volume";
cout<<"\n3.Exit";
cout<<"\nEnter choice(1or2or3): ";
cin>>choice;
if(choice==1)
{ cout<<"\n1.Cube";
cout<<"\n2.Cuboid";
cout<<"\n3.Sphere";
cout<<"\nEnter figure choice: ";

cin>>ch;
if(ch==1)
{ cout<<"\nEnter side of cube: ";
cin>>side;
tsa=6*side*side;
cout<<"\nTotal surface area of cube is: "<<tsa;
}
if(ch==2)
{ cout<<"\nEnter length of cuboid: ";
cin>>l;
cout<<"\nEnter width of cuboid: ";
cin>>b;
cout<<"\nEnter height of cuboid: ";
cin>>h;
tsa=2*(l*b+b*h+l*h);
cout<<"\nTotal surface area of cuboid is: "<<tsa;
}
if(ch==3)
{ cout<<"\nEnter radius of sphere: ";
cin>>r;
tsa=4*3.14*r*r;
cout<<"\nTotal surface area of sphere is: "<<tsa;
}
}
if(choice==2)
{ cout<<"\n1.Cube";
cout<<"\n2.Cuboid";
cout<<"\n3.Sphere";
cout<<"\nEnter figure choice: ";
cin>>choice2;
if(choice2==1)
{ cout<<"\nEnter side of cube: ";
cin>>side;
vol=side*side*side;
cout<<"\nVolume of cube is: "<<vol;
}
if(choice2==2)
{ cout<<"\nEnter lenght of cuboid: ";
cin>>l2;
cout<<"\nEnter breadth of cuboid: ";
cin>>b2;
cout<<"\nEnter height of cuboid: ";
cin>>h2;
vol=l2*h2*b2;
cout<<"\nVolume of cuboid is: "<<vol;
}
if(ch2==3)
{ cout<<"\nEnter radius of sphere: ";
cin>>r;
vol=4/3*3.14*r*r*r;

cout<<"\nVolume of sphere is: "<<vol;


}
}
if(choice==3)
{ exit(3); }
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,m;
cout<<"Enter a number: ";
cin>>n;
cout<<"\nHow many multiples do you want: ";
cin>>m;
for(int i=1;i<=m;i++)
{
cout<<i*n<<",";
}
getch();
}
14,,12,15,16,17,18,19,20,21,22,23,24,25

Das könnte Ihnen auch gefallen