0% found this document useful (0 votes)
28 views3 pages

Loong

Kelllaaaaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

Loong

Kelllaaaaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include<stdio.

h>
#include<conio.h>
#include<process.h>
void main()
{
int n, op, i, prime=1, num, temp, cube, arm=0, rev=1, sum=0;
printf("Enter a number : ");
scanf("%d", &n) ;
if(n>=0)
{
printf("\nNumber is positive.");
menu1:
printf("\n\nMENU :\n");
printf("\n1. Check Prime");
printf("\n2. Check Armstrong");
printf("\n3. Check Palindrome");
printf("\n4. Check Perfect Number");
printf("\n5. Exit");
printf("\n\nEnter Your Choice : ");
scanf("%d", &op);
switch(op)
{
case 1 : for(i=2 ; i<n/2 ; i++)
{
if(n%i==0)
{
prime=0;
break;
}
}
if(prime==0)
{
printf("\nNot Prime.");
}
else
{
printf("\Prime.");
}
break;
case 2 : num=n;
while(num!=0)
{
temp = num%10 ;
cube=temp*temp*temp;
arm=arm+cube;
num=num/10;
}
if(arm==n)
{
printf("\nArmstrong");
}
else
{
printf("\nNot Armstrong");
}
break;

case 3 : num=n;
while(num!=0)
{
rev=rev*10;
rev=rev+num%10;
num=num/10;
}
if(rev==n)
{
printf("\nPalindrome");
}
else
{
printf("\nNot Palindrome");
}
break;
case 4 : for(i=1 ; i<n ; i++)
{
if(n%i==0)
{
sum=sum+i;
}
}
if(sum==n)
{
printf("\nPerfect Number");
}
else
{
printf("\nNon Perfect Number");
}
break;
case 5 : exit(0);
default : printf("\nEnter Valid Option");
goto menu1;
}
}
else
{
printf("\nNumber is negative.");
n=n*(-1);
menu2:
printf("\n\nMENU :\n");
printf("\n1. Count Number of Digits");
printf("\n2. Sum of Digits");
printf("\n3. Count Even and Odd Digit");
printf("\n4. Exit");
printf("\n\nEnter Your Choice : ");
scanf("%d", &op);
switch(op)
{
case 1 : break;
case 2 : break;

case 3 : break;
case 4 : exit(0);
default : printf("\nEnter Valid Option");
goto menu2;
}
}
getch();
}

You might also like