It seems you have posted this problem before. As I'm sure you read the request that Mary left in the other thread, I was wondering what specific question you had about this program - where did you get stuck? Can you post the code?
my code
/* Menu Driven Program */
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int choice,num,yr,a,n,b,sum,n1,n2,dg;
int temp[];
clrscr();
printf("\n\n1. Prime Factors\n");
printf("2. Leap Year\n");
printf("3. Sum of All digits\n");
printf("4. No. in Reverse Order\n");
printf("5. Exit\n");
printf("\n Enter no. of your Choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
printf("Enter the Number :");
scanf("%d",&num);
int i=2;
printf("Prime Factor of the Number is %d : ",num);
while(num!=1)
{
if(num%i==0)
{
printf("%d ",i);
}
else
{
i++;
continue;
}
num=num/i;
}
break;
case 2:
printf("Enter a Year : ");
scanf("%d",&yr);
if(yr%100==0)
{
if(yr%400==0) /* The year is leap year if it is a century year & divisible by 400*/
{
printf("\n Leap Year");
}
else
{
printf("\nNot a Leap Year");
}
}
else
{
if(yr%4==0) /* The year is leap year if it is non-century year & divisible by 4*/
{
printf("\n Leap Year");
}
else
{
printf("Not a leap Year\n");
}
}
break;
case 3:
printf("Enter the Number : ");
scanf("%d",&n);
temp[]=n;
for(i=0;i<=len(temp[]);i++)
{
sum=sum+temp[i];
}
/* while(b<=1)
{
a=n%10;
b=n/10;
sum=0;
sum=sum+a;
n=b;
b--;
}*/
printf("Sum of all digit of the given number is : %d",sum);
break;
case 4:
printf("\nEnter any no.");
scanf("%d",&n1);
/* reverse the number*/
n2=0;
while(n1>0)
{
dg=n1%10;
n2=(n2*10)+dg;
n1=n1/10;
}
printf("The reverse no. is: %d",n2);
break;
case 5:
break;
}
getch();
}
case 3 for calculating the sum of enter no.s but i am not able to do it can u give me the code how to do it i hve to submit it 2mmorrow
Plz