Have a Read!

Hi Everyone.
The idea for this page is to provide new c users simple c tutorials to learn how to develop the logic and more importantly correct way to write syntax.
ENJOY !!!

Wednesday, January 26, 2011

C PROGRAM FOR GREATEST PRODUCT

#include<stdio.h>
int main () {
int x,y,z;
printf("Enter the three numbers:\n");
scanf("%d%d%d",&x,&y,&z);
if ((x*y>y*z) && (x*y>z*x))
{
printf("The greatest product is %d of %d and %d",x*y,x,y);
}
if ((y*z>x*z) && (y*z>x*y))
{
printf("The greatest product is %d of %d and %d",y*z,y,z);
}
if((z*x>x*y)&&(z*x>y*z))
{
printf("The greatest product is %d of %d and %d",z*x,z,x);
}
return 0;
}

No comments:

Post a Comment

Related Posts with Thumbnails