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

What is a stream?

636


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

700


What are loops c?

606


Why c is called top down?

615


Why is c fast?

594






What is the difference between text and binary modes?

635


Why void main is used in c?

557


Differentiate Source Codes from Object Codes

807


Why doesnt the call scanf work?

654


What is include directive in c?

633


How can a string be converted to a number?

504


How can I make sure that my program is the only one accessing a file?

665


Explain the red-black trees?

598


What is a pragma?

660


How can I read a binary data file properly?

626