Redo the program below by reading each digit of the number to be tested into a type
Fantastic news! We've Found the answer you've been seeking!
Question:
Redo the program below by reading each digit of the number to be tested
into a type char variable digit . Display each digit and form the sum of the
numeric values of the digits. Hint: The numeric value of digit is (int) digit - (int) '0'.
#include <stdio.h>
int main()
{
int n = 154368;
int sum = 0;
while(n)
{
printf("%d ",n%10);
sum = sum+n%10;
n = n/10;
}
if(sum%9==0)
printf("\nTrue");
else
printf("\nFalse");
return 0;
}
Related Book For
Elementary Statistics Picturing the World
ISBN: 978-0321911216
6th edition
Authors: Ron Larson, Betsy Farber
Posted Date: