4ever Programming Solutions
All about programming and blogging.
Showing posts with label
Simple
.
Show all posts
Showing posts with label
Simple
.
Show all posts
Friday, March 28, 2014
Simple C++ program to find circumference and diameter of circle
#include<iostream.h>
#include<conio.h>
int main()
{
clrscr();
int diameter,r;
cout<<"Enter radius of circle:"; //prompt
cin>>r;//input
cout<<"Diameter is:"<<r*2<<endl;
cout<<"Circumference is:"<<2*3.14159*r<<endl;
getch();
return 0;
}
Simple C++ program to add two numbers
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<"Enter the numbers to add"<<endl;
cin>>a>>b;
c=a+b;
cout<<"Addition of "<<a<<" and "<<b<<" is="<<c<<endl;
getch();
}
Older Posts
Home
Subscribe to:
Posts (Atom)