Computer Science, asked by raj1099, 1 year ago

write a menu driven program using switch case to perform the following a) to input a number and print the reverse of the number b) to input a number and print whether it is a perfect number or not

Answers

Answered by varshneysamyakoxg8tj
7
switch(n)
{
case 1:
rev=0;
cin>>a;
while(a!=0)
{
r=a%10;
rev=rev*10+r;
a=a/10;
}
cout<<rev;
break;
case 2:
cin>>a;
for(i=1;i<a;i++)
{
if(a%i==0)
s=s+i;
}
if(s==a)
cout<<"pefect no";
else
cout<<"not a perfect no";
break;
}

raj1099: you dont know the program
Similar questions