0
Help me out and solve the program
4 Answers
0
https://www.sololearn.com/coach/270?ref=app
0
#include <iostream>
using namespace std;
int main()
{
int seconds,a;
a=0;
while(a<=60)
cin>>seconds;
cout<<"--a"<<endl;
return 0;
}
0
Thanks.in the body of function you used not gate why? Can you explain the whole function to clear my concept.
0
Here's my attempt (AC),
#include <iostream>
using namespace std;
int main()
{
int sec;
cin >> sec;
while(sec+1) cout << sec-- << "\n";
return 0;
}
Simple and efficient enough. Why sec+1? So when it reaches 0, it still being printed out, otherwise the condition will be evaluated as false. Why sec--? As the problem implicitly says "Print it decreasing until it reaches 0, but also print the number 0", not that I use post-decrement instead of pre-decrement because I need the value *before* getting decremented.