Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 are examples of structures?

1114


How do you declare a variable that will hold string values?

1179


Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

1505


Explain how can I open a file so that other programs can update it at the same time?

1120


Linked lists -- can you tell me how to check whether a linked list is circular?

1091


What are reserved words?

1112


Can you please explain the difference between syntax vs logical error?

1190


How many levels of pointers can you have?

1195


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

1215


Explain what is the difference between #include and #include 'file' ?

1027


How can you allocate arrays or structures bigger than 64K?

1148


How can I call fortran?

1047


What is non linear data structure in c?

1032


Write the Program to reverse a string using pointers.

1024


How can I automatically locate a programs configuration files in the same directory as the executable?

1169