#include<iostream.h>
#include<conio.h>
void sod(int a);
void reverse(int a);
void main()
{
int op,a;
clrscr();
cout<<"1.sum of digit\n\n";
cout<<"2.reverse a no.\n\n";
cin>>op;
switch(op)
{
case 1: sod(a);
break;
case 2: reverse(a);
break;
case 3:cout<<"invalid option";
}
getch();
}
void sod(int a)
{
int sum=0,r;
cout<<"\n\n";
cout<<"enter a no.";
cin>>a;
while(a>0)
{
r=a%10;
a=a/10;
sum=sum+r;
}
cout<<"\n\n";
cout<<"sum is"<<sum;
}
void reverse(int a)
{
int b=0,r;
cout<<"\n\n";
cout<<"enter a no";
cin>>a;
while(a>0)
{
r=a%10;
a=a/10;
b=b*10+r;
}
cout<<"\n\n";
cout<<"reverse is"<<b;
}
#include<conio.h>
void sod(int a);
void reverse(int a);
void main()
{
int op,a;
clrscr();
cout<<"1.sum of digit\n\n";
cout<<"2.reverse a no.\n\n";
cin>>op;
switch(op)
{
case 1: sod(a);
break;
case 2: reverse(a);
break;
case 3:cout<<"invalid option";
}
getch();
}
void sod(int a)
{
int sum=0,r;
cout<<"\n\n";
cout<<"enter a no.";
cin>>a;
while(a>0)
{
r=a%10;
a=a/10;
sum=sum+r;
}
cout<<"\n\n";
cout<<"sum is"<<sum;
}
void reverse(int a)
{
int b=0,r;
cout<<"\n\n";
cout<<"enter a no";
cin>>a;
while(a>0)
{
r=a%10;
a=a/10;
b=b*10+r;
}
cout<<"\n\n";
cout<<"reverse is"<<b;
}