This program takes 3 numbers and finds the largest one. To do this we will compare the numbers with each other and find the largest
Input: a=2,b=4,c=7 Output:7 Largest Number
This program uses only if statement to find the maximum number.
#include <iostream> using namespace std; int main() { int a,b,c; a=2,b=4,c=7; if(a>b) { if(a>c) { printf("%d Largest Number ",a); } else { printf("%d Largest Number ",c); } } else { if(b>c) { printf("%d Largest Number ",b); } else { printf("%d Largest Number ",c); } } return 0; }
The above is the detailed content of C program: find the largest number among three numbers. For more information, please follow other related articles on the PHP Chinese website!