0

I need help

//Write a program that receives a integer, positive three-digit number (number in the range 100-999 inclusive) by the following message #include <iostream> using namespace std; int main() { cout << "enter a three digit number:" << endl; int digit1,digit2,digit3,sum; int num; digit1 = (num%10), digit2 = (num/10%10), digit3 = (num/100), cout << "the sum is: "; sum = digit1 + digit2 + digit3 ; cout << "the sum is" << sum << endl ; return 0; }

13th Nov 2019, 2:06 PM
Tsk4e
Tsk4e - avatar
1 Antwort
+ 2
Add this line to read value for variable <num>: cin >> num; Before this line: digit1 = (num % 10); (Edit) For the next time, please be more descriptive with your question. "I need help" didn't describe the problem clearly, other than being ineffective way to communicate.
13th Nov 2019, 2:46 PM
Ipang