Inspired by a song he just heard, Jojo wants to create a program
where he can enter a number and the program will add the number to
itself then subtract it by one
Format Input
The input consists of a single number which we will call A.
Format Output
The output consists of two lines, the first line should say “A plus A is B” where A is the number from the input and B is A + A. The second line should say “minus one is C” where C is B − 1. Print enter at the end of output. Output must be corresponding to the instruction.
Constraints • 1 ≤ A ≤ 100000
Since programming language isn't mentioned. Question is solved in C language. It can easily be converted to any other language as far as needed.
C code Sniffet:
#include <stdio.h>
int main()
{
int A, B, C;
printf("\n");
printf("\tEnter the value of A: ");
scanf("%d", &A);
printf("\n");
B = A + A;
printf("\t%d plus %d is %d \n", A, A, B);
C = B - 1;
printf("\tminus one is %d \n", C);
printf("\n");
return 0;
}
Sample outputs:
Comment in case of query
Hope it helps
Get Answers For Free
Most questions answered within 1 hours.