-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMIXWHILE.CPP
74 lines (74 loc) · 871 Bytes
/
MIXWHILE.CPP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include<stdio.h>
#include<conio.h>
main()
{
int n,q,r,s,c;
clrscr();
printf("Enter the Value of n = ");
scanf("%d",&n);
q=n;
s=0;
printf("\n1 for Sum of Digit ");
printf("\n2 for Rev of Digit ");
printf("\n3 for Arms of Digit");
printf("\n4 for Palin of Digit");
printf("\n\nEnter Your Choice = ");
scanf("%d",&c);
switch(c)
{
case 1:
while(q>0)
{
r=q%10;
s=s+r;
q=q/10;
}
printf("\n %d Sum of Digit is = %d",n,s);
break;
case 2:
while(q>0)
{
r=q%10;
s=s*10+r;
q=q/10;
}
printf("\n%d Reverse of Digit is = %d",n,s);
break;
case 3:
while(q>0)
{
r=q%10;
s=s+r*r*r;
q=q/10;
}
if(n==s)
{
printf("\n%d is Armstrong ",n);
}
else
{
printf("\n%d is Not Armstrong ",n);
}
break;
case 4:
while(q>0)
{
r=q%10;
s=s*10+r;
q=q/10;
}
if(n==s)
{
printf("\n%d is Palindrome ",n);
}
else
{
printf("\n%d is not Palindrome ",n);
}
break;
default:
printf("\nOver Limit");
break;
}
getch();
}