Q5 If a five-digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits. For example, if the number that is input is 12391, then the output should be displayed as 23502.
Program: 68
If a five-digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits. For example, if the number that is input is 12391, then the output should be displayed as 23502.
Output
Enter N Digit's Number: 12349
Output: 23460
Logic is good but you can see your program at list once output of programe is not match as expected
simple logic is that add 11111 value in inputs number
12391
+ 11111
23502 ans
the question says that when ever a digit 9 comes the number left side to it should not be increased by 2. that is happening in your program so, I think question is not same
#include <stdio.h>
int main()
{
int num [5];
printf(“Enter the numbers: “);
//while entering the number give space between them
scanf(“%d%d%d%d%d”,&num[0],&num[1],&num[2],&num[3],&num[4]);
num[0]=num[0]+1;
num[1]=num[1]+1;
num[2]=num[2]+1;
num[3]=num[3]+1;
num[4]=num[4]+1;
printf(“%d%d%d%d%d”,num[0],num[1],num[2],num[3],num[4]);
return 0;
}