why doesnt this code work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why doesnt this code work

#include <iostream> using namespace std; int main(){ int a; int b = 40; int total= 0; while (b<=100){ cin>> a; total+=a; b++; } return 0; }

16th Feb 2020, 4:08 PM
MÆŘEÁLT
MÆŘEÁLT - avatar
9 Answers
+ 2
Because you didn't write any print statement in your code Use cout<<total; to print the result
16th Feb 2020, 4:21 PM
Mukul Singh Bhist
Mukul Singh Bhist - avatar
+ 1
Check again.. You are missing printing the output.. Only..
16th Feb 2020, 4:18 PM
Jayakrishna 🇮🇳
+ 1
Because you didn't write any print statement in your code Use cout<<total; to print the result
17th Feb 2020, 5:17 AM
robin kansal
robin kansal - avatar
0
What problem your getting..? It works
16th Feb 2020, 4:14 PM
Jayakrishna 🇮🇳
0
can u pls elaborate on that
16th Feb 2020, 4:14 PM
MÆŘEÁLT
MÆŘEÁLT - avatar
0
it jxt gives me a no output every tym i run it
16th Feb 2020, 4:15 PM
MÆŘEÁLT
MÆŘEÁLT - avatar
0
oo yeah tnx bro
16th Feb 2020, 4:20 PM
MÆŘEÁLT
MÆŘEÁLT - avatar
0
Mikelet Jr Wel come...
16th Feb 2020, 4:22 PM
Jayakrishna 🇮🇳
0
yeah i finally figured it out tnx
16th Feb 2020, 4:23 PM
MÆŘEÁLT
MÆŘEÁLT - avatar