Headlines
Loading...
C Program to Condense a number

C Program to Condense a number

C Program to Condense a number 

#include<stdio .h="">
#include<conio .h="">
void cn(int n)
{
   int i=0,c=0,r=0;

   while(n!=0)
   {
 i++;
 r=n%10;
 c=c+r;
 n=n/10;
   }
   if(i&gt;1)
     cn(c);
   else
     printf("\n Condensed Number : %d",c);

}
void main()
{

  int num,c;
  clrscr();
  printf("\n Enter Number: ");
  scanf("%d",&amp;num);
  cn(num);
  getch();
}


 **************** OUTPUT ********************

Enter Number: 98

Condensed Number: 8</conio></stdio>
*** PLEASE checkout the Best deals from for top sites like Amazon, Flipkart etc ***