Beruflich Dokumente
Kultur Dokumente
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;
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;
}
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;