What is the output of this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output of this code

Int main() { Int f=1,i=2; While(++i<4){ f*=i; } cout<<f<<endl; }

3rd Sep 2019, 9:19 AM
Maxamed Abdi
Maxamed Abdi - avatar
5 Answers
0
3
3rd Sep 2019, 9:46 AM
Prathvi
Prathvi - avatar
0
3
3rd Sep 2019, 11:29 AM
Maxim Balakirev
Maxim Balakirev - avatar
0
It is 3.
3rd Sep 2019, 5:23 PM
Rohan Rao
Rohan Rao - avatar
0
nice one
11th Sep 2019, 1:01 PM
ali saad soliman
ali saad soliman - avatar
0
#include <iostream> using namespace std; int main() { int f=1,i=2; while(i++<4){ // here i=2 then 3 f*=i; // here i=3 then 4 } cout<<"f while i++ ="<<f<<endl; ///////////////// int ff=1,ii=2; while(++ii<4){ //here ii=3 ff*=ii; //here also ii=3 } cout<<"ff while ++ii="<<ff<<endl; return 0; }
11th Sep 2019, 1:28 PM
ali saad soliman
ali saad soliman - avatar