C program to find a super digit.

 

01 #include<stdio.h>
02
03 int main()
04 {
05 long int n;
06 long int x,s;
07
08 printf("Enter any number : ");
09 scanf("%ld",&n);
10
11 while(n>=10)
12 {
13 x=n;
14 s=0;
15 while(x>0)
16 {
17 s=s+(x%10);
18 x=x/10;
19 }
20 n=s;
21 }
22 printf("nSuper Digit of the given number is %ld",n);
23
24 return 0;
25 }
 
 
OUTPUT:

Enter any number : 124587

Super Digit of the given number is 9

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.