Tuesday, October 22, 2013

MULTI-DIGITS NO.STRING

  /*WAP TO INPUT TWO MULTI-DIGITS NO.S AND COUNT NO. OF DIGITS IN BOTH NO.S .


#include<stdio.h>
#include<conio.h>
 void main()
 {
long int n1,n2;
int count1=0;
int count2=0;

clrscr();

printf("\nEnter 1st multi-digit no.(non-zero)= ");
scanf("%ld",&n1);
printf("\nEnter 2nd multi-digit no.(non-zero)= ");
scanf("%ld",&n2);

while(n1>0)
{
n1=n1/10;
count1+=1;
}
while(n2>0)
{
n2=n2/10;
count2+=1;
}

printf("\nNo. of digits in 1st no.= %d",count1);
printf("\nNo. of digits in 2nd no.= %d",count2);

if(count1==count2)
printf("\n\nBoth no.s have same no. of digits.");
else
printf("\n\nBoth no.s have different no. of digits.");

getch();
 }