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 declaration and definition in c?
What is p in text message?
write a program to generate address labels using structures?
Define C in your own Language.
How do I get a null pointer in my programs?
what are the advantages of a macro over a function?
Why do we use & in c?
Is there anything like an ifdef for typedefs?
Is fortran still used in 2018?
What does void main return?
What do you mean by invalid pointer arithmetic?
What is #include called?
What are pointers?
Are bit fields portable?
What are disadvantages of C language.