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 is a stream?
The number of measuring units from an arbitarary starting point in a record,area,or control block to some other point a) recording pointer b) offset c) branching d) none
What are loops c?
Why c is called top down?
Why is c fast?
What is the difference between text and binary modes?
Why void main is used in c?
Differentiate Source Codes from Object Codes
Why doesnt the call scanf work?
What is include directive in c?
How can a string be converted to a number?
How can I make sure that my program is the only one accessing a file?
Explain the red-black trees?
What is a pragma?
How can I read a binary data file properly?