Answers

2014-08-12T12:59:20+05:30
#include <stdio.h>
#include <conio.h>
void main()
{
int num,temp,sum=0,rem,i,choice;
clrscr();
printf(“\nEnter the number “); 
scanf(“%d”,&num);
printf(“\n****************************”);
printf(“\n* 1. Sum of the digits     *”);
printf(“\n* 2. Exit                  *”);
printf(“\n****************************”);
do
{
   printf(“\n\nEnter choice =>”);
   scanf(“%d”,&choice);
  switch 
(choice)
   {
       case 1:  
       temp=num;

 
      do
         {
              rem=temp%10;
              sum=sum+rem;
              temp=temp/10;
          }
         while(temp!=0);     
         printf(“\nSum of digits of %d is =%d”,num,sum);  
         break;
  
 case 2:
      exit();
 
default:    printf(“\nChoice is wrong!!!”);
}

while(choice<=2);  
getch();
} 
1 1 1
click on thankyou if u find it useful