Yasir's Blog
Pages
About Me
C Programs
Java Programs
ML
Contact Me
Sitemap
Privacy Policy
Home
»
C Programs
»
C Program to find greatest of three numbers
Sunday, 1 January 2017
C Program to find greatest of three numbers
Program:
This program is saved as GreatestOfThree.c
#include
void main() { int a,b,c; printf("Enter any three numbers\n"); scanf("%d%d%d",&a,&b,&c); if(a>b&&a>c) /* if a is greater than b and c */ printf("Greatest number is : %d",a); else if(b>c) /* if not a than if b greater than c */ printf("Greatest number is : %d",b); else printf("Greatest number is : %d",c); }
Output:
Enter any three numbers 144 776 225 Greatest number is : 776
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment