+ 1
What is the output of the following cpp program and please explain how that output came?
#include<iostream> using namespace std; int main () { int a=7; int b=3; cout<<a/b+a; }
6 Réponses
+ 18
a/b means 7/3. The quotient after the division of 7 by 3 is added to the value of the variable a.
7/3 = 2; (3*2 = 6) the remainder results to 1 but the quotient is 2.
and 2+7 = 9;
where 7 is the value of a.
+ 3
9?
+ 3
#include<iostream>
using namespace std;
int main ()
{
int a=7;
int b=3;
cout<<(a/b)+a; // a/b= 7/3=2,33
} //type int without virgul
//2,33->2
//2+a = 2+7 =9
+ 3
thank you so much..for detailed explaination exactly what i want
thank you...
+ 1
it 9
0
yeah its right but i want to know how that 9 came