Monday, November 14, 2011

Add One Print New

Wap to take a 3 digit number from user .Add one to every digit and print the new number


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int onum=156;
int nnum;
int p,q,r;
p=onum%10;
onum/=10;
q=onum%10;
onum/=10;
r=onum%10;
nnum=(r+1)*100+(q+1)*10+(p+1);
cout<<"nnum is"<<nnum;
getch();
}


**************
OUTPUT:
267
**************

No comments:

Post a Comment