在三个数字中找到最大数字的C程序
该程序采用3个数字,并在所有数字中找到最大的数字。为此,我们将相互比较数字,找出最大的数字
Input: a=2,b=4,c=7 Output:7 Largest Number
说明
该程序仅使用if语句查找最大数目。
示例
#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;
}