Question

Inspired by a song he just heard, Jojo wants to create a program where he can...

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

Homework Answers

Answer #1

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

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Take Three Jojo just graduated and moved up to grade 4. Today is his first day...
Take Three Jojo just graduated and moved up to grade 4. Today is his first day in 4th grade. Unfortunately, the lessons are held online because of pandemic. So that the quality of learning remains good, Jojo’s teacher gives a hard task for 4th grader. After the 4th graders finished their first task which is prime factorization. Jojo’s teacher set up a game for the stundets. The game is very simple. Given N colored balls, each student has to take...
Create a program that filters the data in a CSV file of product data based on...
Create a program that filters the data in a CSV file of product data based on some search word and prints the resulting output to a new file. Additionally, the program will print the number of items filtered to stdout. • Your program should take three arguments: an input file to process, an output file to save the results, and a search word. • If the output file already exists or cannot be opened, warn the user by printing "CANNOT...
Create program that sorts words of a string based on first letter of each word. Use...
Create program that sorts words of a string based on first letter of each word. Use C programming language. - Only use stdio.h and string.h - Remove any newline \n from input string - Use insert function - Input prompt should say "Enter string of your choice: " - Output should print sorted string on new line Example:     Enter string of your choice: this is a string     a is string this
In Java. Write a program that reads-in a times table-number. The program, using this table-number will...
In Java. Write a program that reads-in a times table-number. The program, using this table-number will produce the following report (as shown). The first item in the report is a number with starting value 1. Second column is the word “ X ” (representing the times symbol). Third column is the table-number (itself). Following is an equal sign “ = “ (representing a result). Last column is the result of the operation for that line or row which is the...
This is a Java program Program Description You work for a local cell phone company and...
This is a Java program Program Description You work for a local cell phone company and have been asked to write a program to calculate the price of a cell phone data plan being purchased by a customer. The program should do the following tasks: Display a menu of the data plans that are available to be purchased. Read in the user’s selection from the menu.  Input Validation: If the user enters an invalid option, the program should display an error...
Program Behavior Each time your program is run, it will prompt the user to enter the...
Program Behavior Each time your program is run, it will prompt the user to enter the name of an input file to analyze. It will then read and analyze the contents of the input file, then print the results. Here is a sample run of the program. User input is shown in red. Let's analyze some text! Enter file name: sample.txt Number of lines: 21 Number of words: 184 Number of long words: 49 Number of sentences: 14 Number of...
Create a program to calculate and print basic stats on a set of a given input...
Create a program to calculate and print basic stats on a set of a given input values representing students' scores on an quiz. 1) Ask the user for the total number of quiz scores to be input (assume a positive integer will be given). 2) Create an array to hold all the quiz scores and then get all the scores from input to put into the array. For example, if the user input 10 in step (1) then you should...
Create a program that generates a file of random numbers, and then prints them in neat...
Create a program that generates a file of random numbers, and then prints them in neat fashion to another file, and also saves to that file the average and standard deviation of those numbers. I) First, you would need to generate a file of random numbers that consists of N random numbers (100 < N < 1000). Each random digit should be a real number (type double) between 0 and 50. This file and its digits would now serve as...
Please solve in c++ Split the Number Programming challenge description: You are given a number N...
Please solve in c++ Split the Number Programming challenge description: You are given a number N and a pattern. The pattern consists of lowercase latin letters and one operation "+" or "-". The challenge is to split the number and evaluate it according to this pattern e.g. 1232 ab+cd -> a:1, b:2, c:3, d:2 -> 12+32 -> 44 Input: Your program should read lines from standard input. Each line contains the number and the pattern separated by a single whitespace....
For this assignment, you will be creating a simple “Magic Number” program. When your program starts,...
For this assignment, you will be creating a simple “Magic Number” program. When your program starts, it will present a welcome screen. You will ask the user for their first name and what class they are using the program for (remember that this is a string that has spaces in it), then you will print the following message: NAME, welcome to your Magic Number program. I hope it helps you with your CSCI 1410 class! Note that "NAME" and "CSCI...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT