Please help me to solve given code . My output is 3 2 1 but the expected Output is: 3 enter 2 enter 1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please help me to solve given code . My output is 3 2 1 but the expected Output is: 3 enter 2 enter 1

#include <iostream> using namespace std; int main() { int seconds; int num=3; //your code goes here while (num >= 1){ cin>>seconds; cout <<num; num --; } return 0; }

3rd Nov 2020, 5:14 AM
Horilal S Nirmalkar
Horilal S Nirmalkar - avatar
3 Answers
+ 6
Add the below stmt under while loop: if(num==1) { cout<<num; break; } cout<<num<<" enter";
3rd Nov 2020, 5:27 AM
Alphin K Sajan
Alphin K Sajan - avatar
+ 6
Horilal S Nirmalkar what is the purpose of seconds in ur code?
3rd Nov 2020, 5:21 AM
Alphin K Sajan
Alphin K Sajan - avatar
0
We want 3 2 1 as output
26th Feb 2023, 10:54 AM
korthiwada sathwika
korthiwada sathwika - avatar