wap in c to accept a number display the total count of digit
Answer Posted / santhi perumal
#include<stdio.h>
#include<conio.h>
int main()
{
int number,m,sum =0,count =0;
printf("Enter the number \n");
scanf("%d",&number);
while(number != 0)
{
m = number % 10;
sum = sum + m;
count++;
number = number / 10;
}
printf("\nThe number of Digits in the Given Number is
%d\n",count);
printf("The Sum of Digits in the Given Number is %d\n",sum);
}
| Is This Answer Correct ? | 19 Yes | 5 No |
Post New Answer View All Answers
What are the advantages of union?
What is the explanation for the dangling pointer in c?
i want to know the procedure of qualcomm for getting a job through offcampus
Dont ansi function prototypes render lint obsolete?
What is a #include preprocessor?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
What is || operator and how does it function in a program?
string reverse using recursion
What is array of structure in c programming?
please send me the code for multiplying sparse matrix using c
What are the advantages of using new operator as compared to the function malloc ()?
What is the hardest programming language?
why we wont use '&' sing in aceesing the string using scanf
What is return in c programming?