C ++中的简单算术运算符示例程序
C++具有5个基本的算术运算符。他们是-
加法(+)
减法(-)
师(/)
乘法(*)
模数(%)
#include <iostream>
using namespace std;
main() {
int a = 21;
int b = 10;
int c ;
c = a + b;
cout << "Line 1 - Value of c is :" << c << endl ;
c = a - b;
cout << "Line 2 - Value of c is :" << c << endl ;
c = a * b;
cout << "Line 3 - Value of c is :" << c << endl ;
c = a / b;
cout << "Line 4 - Value of c is :" << c << endl ;
c = a % b;
cout << "Line 5 - Value of c is :" << c << endl ;
return 0;
}输出结果
这将给出输出-
Line 1 - Value of c is :31 Line 2 - Value of c is :11 Line 3 - Value of c is :210 Line 4 - Value of c is :2 Line 5 - Value of c is :1
热门推荐
10 法考面试祝福语简短
11 婆婆生娃祝福语简短
12 哥哥生日礼包祝福语简短
13 诗词送行祝福语大全简短
14 诗词文案祝福语简短精辟
15 生日祝福语 简短独特高考
16 职场离职文案祝福语简短
17 国庆简短幽默祝福语
18 护士辞职送行祝福语简短