Question

instructions read in 4 numbers. sum up the 4 numbers. print the four numbers and the...

instructions

read in 4 numbers. sum up the 4 numbers. print the four numbers and the sum

Using the Marie editor and compiler, write a program that will satisfy these requirements. Cut and paste your code (from the editor) into the answer area of this question

C+

Homework Answers

Answer #1
#include<iostream>
using namespace std;
int main(){
        int n1,n2,n3,n4;
        //reading 4 numbers from user
        cin>>n1>>n2>>n3>>n4;
        //printing variables and sum
        cout<<n1<<" + "<<n2<<" + "<<n3<<" + "<<n4<<" = "<<n1+n2+n3+n4<<endl;
}

NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.

Please Like and Support me as it helps me a lot

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
Read in a file "numbers.txt" into a Java program. Sum up all the even numbers over...
Read in a file "numbers.txt" into a Java program. Sum up all the even numbers over 50. Print the result to the console using System.out.println(); The file will only have numbers. code below import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Scanner; public class ReadingFiles { public static void main(String[] args) throws FileNotFoundException { System.out.println(totalEven); } }
a) sum = 0 for letter in '12345' : sum = sum + int(letter) print('sum =...
a) sum = 0 for letter in '12345' : sum = sum + int(letter) print('sum = ', sum) Write a program which reads a string containing any characters from the user and prints the sum of the digits in the string. For example, if the string from the user is "I want 3 oranges and 24 bananas', then the output would be 9, since 3 + 2 + 4 = 9. Note that a character C is a digit if...
write C program using function to read 20 float numbers and print the average of them...
write C program using function to read 20 float numbers and print the average of them after changing the negative to positive number.
Write a full C++ program to read a series of integer numbers from standard input and...
Write a full C++ program to read a series of integer numbers from standard input and print them out in reverse order, one per line. You may assume that there will be a minimum of 2 numbers to read and a maximum of 200.
IN JAVA: Write code (using ArrayLists) to read a line of input from the user and...
IN JAVA: Write code (using ArrayLists) to read a line of input from the user and print the words of that line in sorted order, without removing duplicates. For example, the program output might look like the following: Type a message to sort: to be or not to be that is the question Your message sorted: be be is not or question that the to to
IN JAVA 1. Write up a small program that accepts two integers from the user. Print...
IN JAVA 1. Write up a small program that accepts two integers from the user. Print which of the two values is bigger. If they are the same, print that they are the same. 2. Write a method that accepts three doubles. Calculate and return the average of the three passed double values. 3. Write up a method that accepts a score between 0-10. Print out a message according to the following table. You ay personally decide the boundaries. i.e.,...
Uses a while loop to print the numbers from 3 - 19. Uses a do-while loop...
Uses a while loop to print the numbers from 3 - 19. Uses a do-while loop to print the numbers from 42 - 56. Uses a for loop to print the numbers from 87 - 95. Asks the user for 2 numbers. Uses a loop to print all numbers between the given numbers, inclusive. Note: Consider that your user's second number can be lower! (see example below) Note: Also consider that your user might give you two of the same...
C programming language. Write a program to print reverse of all the numbers from m to...
C programming language. Write a program to print reverse of all the numbers from m to n using functions with arguments and no return type. The inputs in the program will be m and n variables and need to take these variables as arguments.
C++ INSTRUCTIONS Problem Specification : Write a program that reads a group of numbers from the...
C++ INSTRUCTIONS Problem Specification : Write a program that reads a group of numbers from the user and places them in an array of type float. Once the numbers are stored in the array, the program should average and print the result. Use pointer notation wherever possible. Program Output (with Input Shown in Bold): Enter number: 2 Enter another (y/n)? y Enter number: 4 Enter another (y/n)? y Enter number: 6 Enter another (y/n)? y Enter number: 8 Enter another...
Write a script to display numbers from 1 to n, where n is an integer provided...
Write a script to display numbers from 1 to n, where n is an integer provided by users (if not, default to 10). Hint: use “read” command to accept user input. a) Display the source code in an editor (#4-9) b) Execute your script in the terminal, and display the command and the result (#4-10)
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT