#include<iostream>
using namespace std;
int main()
{
   int a=3,b=7,c,d,e,f,g;
   c=b/a;   //除法運算
   d=b%a;   //餘數運算
   e=a*b;   //乘法運算
   f=a++*3; //累加運算
   g=b--*3; //累減運算

   cout<<"7除3="<<c<<"於"<<d<<endl;
   cout<<"7乘3="<<e<<endl;
   cout<<"3累加3次="<<f<<endl;
   cout<<"7累減3次="<<g<<endl;
   system("pause");
   return 0;
}

 

輸出結果:

7除3=2於1
7乘3=21
3累加3次=9
7累減3次=21
請案任意鍵繼續 . . .

 

 

     乘法"*",除法"/",餘數"%"

arrow
arrow
    全站熱搜

    霄狼一哥 發表在 痞客邦 留言(1) 人氣()