#import <Foundation/Foundation.h>
@interface digits:NSObject
{
int
rev,n,n1,d;
}
-(void)reverse;
@end
@implementation digits
-(void)reverse
{
printf("Enter any Numeric Value:");
scanf("%d",&n);
while (n!=0)
{
d=n%10;
rev=rev*10+d;
n=n/10;
}
while (rev!=0)
{
d=rev%10;
switch
(d)
{
case
0:
printf("Zero\n");
break;
case
1:
printf("One\n");
break;
case
2:
printf("Two\n");
break;
case
3:
printf("Three\n");
break;
case
4:
printf("Four\n");
break;
case
5:
printf("Five\n");
break;
case
6:
printf("Six\n");
break;
case
7:
printf("Seven\n");
break;
case
8:
printf("Eight\n");
break;
case
9:
printf("Nine\n");
break;
default:
printf("Please Enter any digit");
break;
}
rev=rev/10;
}
}
@end
int main (int argc,
const char
* argv[])
{
digits
*dig=[[digits alloc]init];
[dig reverse];
return 0;
}
No comments:
Post a Comment