Home » C SOURCE CODES

C Program to display the No. of Digits in an Entered Number

Submitted by Srikanth on Monday, 3 December 2007No Comment

This program displays the number of digits present in the number that is entered through the input.

#include<stdio.h>
#include<conio.h>

void main()
{
unsigned long int num;
int i=0;
clrscr();
printf(“Enter the digit\n”);
scanf(“%lu”,&num);
while(num!=0)
{
num=num/10;
++i;
}
printf(“Length=%d”,i);
getch();
}

Popularity: 1% [?]

Visitors who read this post, also read:

  1. Display Legal Notice on Startup of your Windows


  By using/following this site you agree to our Legal Disclaimer

Subscribe to GoHacking.Com


Enjoyed this article?
Subscribe to GoHacking.Com and get daily updates in your email for free

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.