Write a programme, input a three digit number from user and print sum of given numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a programme, input a three digit number from user and print sum of given numbers

three digit number be like 123,,456 etc and their sum like 123 (three digit number) so their sum =1+2+3=6

13th Jun 2017, 3:51 PM
dev
11 Answers
+ 5
yes.....see the number and add the digits yourself ...😈😈😈.. .. ... just kidding..never mind
13th Jun 2017, 4:40 PM
cHiRaG GhOsH
cHiRaG GhOsH - avatar
0
any simple way to get i am new one to learn C++
13th Jun 2017, 4:39 PM
dev
0
bhai I didn't know 'res' and the use of %
13th Jun 2017, 4:42 PM
dev
0
https://code.sololearn.com/ceUqZZz5STam/?ref=app ask me anything if you don't understand
13th Jun 2017, 5:11 PM
Mohiuddin Sumon
Mohiuddin Sumon - avatar
0
% is modulus operator , it means remainder. 10%3 = 1 this is because reminder of 10/3 is 1
13th Jun 2017, 5:14 PM
Mohiuddin Sumon
Mohiuddin Sumon - avatar
0
why did we take sum=0?
13th Jun 2017, 5:16 PM
dev
0
we use sum variable to store the summation of digits, there might be garbage value to sum , to avoid it we initialize it with 0. Hope you get it
13th Jun 2017, 5:19 PM
Mohiuddin Sumon
Mohiuddin Sumon - avatar
0
ok I understand better than 1st one thanks
13th Jun 2017, 5:23 PM
dev
0
happy to know :)
13th Jun 2017, 5:24 PM
Mohiuddin Sumon
Mohiuddin Sumon - avatar
0
ya
13th Jun 2017, 5:26 PM
dev