0
Help me please, how can I make C++ program first natural numbers?
#include <iostream> using namespace std; int main() { int i, = 0; for(i=1;i<=10;i++) sum= 0,sum+i; if(i<10) cout <<i<<" + "; return 0; }
5 odpowiedzi
+ 4
1. You have to declare variables first before using (try to find out what variable that is).
2. If you want to have multiple statement inside a loop, use curly brackets { }.
+ 3
NOTE : Inside loop, when your loop is running the value of sum is being 0 , please see there are some syntax error also.
Try again, Don't give up!
All the best!
+ 2
I spent about 3 mins reading your code and see what's happening and was gonna point the errors but other people already pointed it out, sooo i guess this is what you wanna print out?
https://code.sololearn.com/cD5uZf1JSG0Z/?ref=app
+ 1
Ah okay, thank you.
+ 1
Thank you for helping me
https://code.sololearn.com/cTt7MU1rw7vK/?ref=app