Showing posts with label three. Show all posts
Showing posts with label three. Show all posts
Friday, February 13, 2015
C Program to find Greatest number among three numbers
#include<iostream.h>
#include<conio.h>
void main()
{
int x,y,z,max;
clrscr();
cout<<"Enter The Three Numbers ";
cin>>x>>y>>z;
max=x;
if (y>max)
max=y;
if (z>max)
max=z;
cout<<"
"<<"The Greatest Number among "<<x<<" "<<y<<" "<<z<<" is "<<max;
getch();
}
#include<conio.h>
void main()
{
int x,y,z,max;
clrscr();
cout<<"Enter The Three Numbers ";
cin>>x>>y>>z;
max=x;
if (y>max)
max=y;
if (z>max)
max=z;
cout<<"
"<<"The Greatest Number among "<<x<<" "<<y<<" "<<z<<" is "<<max;
getch();
}
Thursday, February 12, 2015
C Program to calculate sum and average of three numbers
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr() //to clear the screen
float a,b,c,sum,av;
cout<<"Enter three numbers:";
cin>>a>>b>>c;
sum=a+b+c;
av=sum/3;
cout<<"
SUM="<<sum;
cout<<"
Average="<<av;
getch(); //to stop the screen
}
Subscribe to:
Posts (Atom)