Can somebody tell me what will this program give,i.e., what is its result?? { clrscr(); int a=5 ,count=0; cout<<"enter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can somebody tell me what will this program give,i.e., what is its result?? { clrscr(); int a=5 ,count=0; cout<<"enter

{ clrscr(); int a,count=0; cout<<"enter your number"; cin>>a; while(a>0) { cout<<"please re-enter your number"; cin>>a; count=count+a; } cout<<count; getch(); }

27th Sep 2016, 5:59 PM
Devansh Kaushik
Devansh Kaushik - avatar
3 Answers
+ 3
It takes inputs until you enter 0 (or a negative number, but you don't want to do that here), and then it displays their sum.
27th Sep 2016, 7:12 PM
Zen
Zen - avatar
+ 1
Thanks, Zen.. You are the best.
28th Sep 2016, 5:27 AM
Devansh Kaushik
Devansh Kaushik - avatar
- 1
it will give the error.
28th Sep 2016, 6:06 AM
bhanderi shital
bhanderi shital - avatar