mercredi 23 juin 2021

Why is this perfect code not running and it says I got error when I dont? [duplicate]

image

I'm on Linux using VSCode with the C++ extension. I added gdb and g++!

#include <iostream>
#include <iomanip>
#include <list>
using namespace std;

int main(){
    int number, sum=0;

    cout<<"Number: "<<endl;
    cin>>number;

    while(number>0){
        sum+=(number%10);
        number/=10;
    }
    cout<<"Answer: "<<sum;
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire