C ++程序在三个元素中找到最小的元素
在本教程中,我们将讨论一个程序,以在提供的三个元素中找到最小的元素。
我们将提供三个元素/整数,我们的任务是比较它们并找到其中最小的元素/整数。
示例
#include <bits/stdc++.h>
using namespace std;
int main() {
int a = 45, b = 72, c = 10;
if (a <= b && a <= c)
cout << a << " is smallest" << endl;
else if (b <= a && b <= c)
cout << b << " is smallest" << endl;
else
cout << c << " is smallest" << endl;
return 0;
}输出结果
10 is smallest
热门推荐
10 春节拜年祝福语儿童简短
11 租房明天搬家祝福语简短
12 剪简短的新年祝福语
13 化学老师元旦祝福语简短
14 致姐姐生日祝福语简短
15 新人结婚简短祝福语大全
16 妈妈生日祝福语简短温暖
17 2026猪年祝福语简短语
18 给男生的简短祝福语