program to print a new number by adding one to each of its digits



#include<stdio.h>
#include<conio.h>
void main()
{

long int n,i2=1,i=0,sum2=0,num,x,sum=0;
 clrscr();
printf("Enter a number=");
scanf("%ld",&n);
x=n;
while(n>0)
{
sum++;
n=n/10;
}
printf("Number of digits in this number=%ld",sum);
while(i<sum)
{
sum2=x+i2;
i2=i2*10+1;
i++;
}
printf("Number formed %ld",sum2);
getch();
}

LIST OF PROGRAMS

Comments