English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

this is not any kind of hw help . i have a test tomorow
that's why

a program to compute the sum of digits of a given number and reverse the digits of given number. and compute the number. of digits in the given number.

if itz with logic it will be more appreciated
tanx
tutu

2006-08-25 14:02:24 · 1 answers · asked by Remo 1 in Computers & Internet Software

1 answers

int sum = 0, count = 0, char all[100];
// I'm not completely recalling how C++ string goes

while (number != 0) {
sum += number % 10;
count++;
all += number % 10 + '0';
number = number - number % 10 / 10;
}

2006-08-25 14:16:10 · answer #1 · answered by Andy T 7 · 1 0

fedest.com, questions and answers