Xiang_Chu
Forum Addict
Welcome fellow Coders
NOTE: Please no flaming guys! this is made entirely for extreme beginners and it is just to help out, i am NOT posting this to get my Post count up>.>
~I will Update this thread Regularly, so if you are finding this useful, don't forget to check this thread Everyday!
Program to calculate the sum of 2 numbers.
Code:
#include<iostream.h>
#include<conio.h>
void main ()
{ clrscr ();
int a,b,S; //S is the variable ive used for sum
cout<<"Enter Number 1:\n;
cin>>a;
cout<<"Enter Number 2:\n;
cin>>b;
S=a+b;
cout<<"Sum ="<<S;
}
Program to calculate the area of a rectangle.
Code:
#include<iostream.h>
#include<conio.h>
void main ()
{ clrscr ();
float l,b,A; //A is for Area
cout<<"Enter Length\n";
cin>>>l;
cout<<"Enter Breadth\n";
cin>>b;
A=l*b;
cout<<"Area =";
cout<<A;
}
Program to calculate the volume of a cuboid.
Code:
#include<iostream.h>
#include<conio.h>
void main ()
{ clrscr ();
float l,b,h,V; //V stands for Volume
cout<<"Enter Length\n";
cin>>l;
cout<<"Enter Breadth\n";
cin>>b;
cout<<"Enter Height\n";
cin>>h;
V=l*b*h;
cout<<"Volume =";
cout<<V;
}
Program to find Simple Interest.
Code:
#include<iostream.h>
#include<conio.h>
void main ()
{ clrscr ();
float P,R,T,Si;
cout<<"Enter Principal\n";
cin>>P;
cout<<"Enter Rate\n";
cin>>R;
cout<<"Enter Time\n";
cin>>T;
Si=(P*R*T)/100;
cout<<"Simple Interest =";
cout<<Si;
}
Program to calculate Area of a Circle.
Code:
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
float Pi,R,A;
const Pi = 3.14;
cout<<"Enter Radius:\n";
cin>>R;
A=Pi*R*R;
cout<<"Area="<<A<<"cm^2";
}
Program to calculate area of a triangle.
Code:
#include<iostream.h>
#include<conio.h>
void main()
{clrscr();
float b,h,A; //A is for Area
cout<<"Enter Base:\n";
cin>>b;
cout<<"Enter Height\n";
cin>>h;
A=(b*h)/2;
cout<<"Area ="<<A<<"cm^2";
}
Program to convert Fahrenheit to Celcius.
Code:
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr ();
float F,C;
cout<<"Enter Temperature in Fahrenheit:\n";
cin>>F;
C=(F-32)*5/9;
cout<<"Temperature in Celcius="<<C<<"Degrees Celcius";
}

