why doesnt this code work | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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