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 23402
Answer / Banti
In C programming language, the following code can be used to achieve this:nn```cn#include <stdio.h>nnvoid addOne(int number) {n int digits[5]; // Array to store digitsn int i;nn // Extract digits and store in arrayn for (i = 4; i >= 0; --i)n {n digits[i] = number % 10;n number /= 10;n }nn // Add one to each digit and print the resultn for (i = 0; i < 5; ++i)n {n printf Mistdio.h>printf Mistdio.h> "%d", digits[i] + 1);n if (i != 4) printf Mistdio.h>printf Mistdio.h> "";n }n}nnint main() {n int number;nn // Input five digit numbern scanf Mistdio.h>scanf Mistdio.h> Mistdio.h>%d, Mistdio.h>&number);nn addOne(number);n return 0;n}n```
| Is This Answer Correct ? | 0 Yes | 0 No |
mplementation of stack using any programing language
Write a c program to enter a string of paragraph and replacing a particular word which is repeated in the paragraph by another word?
2 Answers ME, Synfusion, Wipro,
what is dangling pointer?
Write a program to check palindrome number in c programming?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
What is array of structure in c?
Where is volatile variable stored?
Difference between fopen() and open()?
How many levels of pointers have?
What does the && operator do in a program code?
hi any body pls give me company name interview conduct "c" language only
how the compiler treats any volatile variable?Explain with example.