0

C ++ countdown the code work but I did not receive any point

#include <iostream> using namespace std; int main() { int n; /* your code goes here */ for(int n = 11;n >0;n--){ cout<< n <<endl; if(n % 5 ==0){ cout << "Beep"<< endl; }; } // i won return 0; }

3rd Aug 2021, 6:10 PM
Adegbite Ismail
Adegbite Ismail - avatar
9 odpowiedzi
+ 4
What is the use of int n ; On loop statement u have created a new variable called int n =11; So there is no use of int n;
3rd Aug 2021, 6:13 PM
Pariket Thakur
Pariket Thakur - avatar
+ 5
Re-read the task carefully and do not change the code already suggested.
3rd Aug 2021, 6:39 PM
Solo
Solo - avatar
+ 2
Why did you delete the data entry cin >> n?🤔
3rd Aug 2021, 6:25 PM
Solo
Solo - avatar
+ 1
If you want to refer to someone in particular, type the name through the symbol @Adegbite Ismail
3rd Aug 2021, 7:24 PM
Solo
Solo - avatar
0
You have created a new n in the loop so it will not access the n outside the loop
4th Aug 2021, 11:58 PM
Hamza Mohammad Khan
Hamza Mohammad Khan - avatar
0
Try this #include<iostream> using namespace std; int main(){ int n; cin>>n; //your code goes here while(n>0){ cout<<n<<endl; if(n%5==0) cout<<"Beep\n; n--; } return 0; }
5th Aug 2021, 11:41 AM
Mohammad Matin Kateb
Mohammad Matin Kateb - avatar
0
Thanks guys It has work
5th Aug 2021, 1:12 PM
Adegbite Ismail
Adegbite Ismail - avatar
- 3
Hi coder I know but that's not the problem There are 5 test case 3 is for pro And 2 in for people like me But test case 2 and 1 Mark it correct but no point
3rd Aug 2021, 6:32 PM
Adegbite Ismail
Adegbite Ismail - avatar
- 3
Please let talk on WhatsApp +2347042740799
3rd Aug 2021, 7:09 PM
Adegbite Ismail
Adegbite Ismail - avatar