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


Please Help Members By Posting Answers For Below Questions

write a programming in c to find the sum of all elements in an array through function.

1710


Define circular linked list.

575


What is binary tree in c?

628


Explain about the functions strcat() and strcmp()?

602


Is main an identifier in c?

607






What is the explanation for the dangling pointer in c?

684


explain what is fifo?

636


What does s c mean on snapchat?

590


c program to compute AREA under integral

1818


Can an array be an Ivalue?

668


main() { printf("hello"); fork(); }

699


how to construct a simulator keeping the logical boolean gates in c

1732


Does c have enums?

604


Explain how do you generate random numbers in c?

628


What is a struct c#?

605