Question

How do you do this again? thanks in advance guys Take as input 10 integers from...

How do you do this again? thanks in advance guys

Take as input 10 integers from the user and //output the sum of all these numbers, modulo 10

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include<iostream>

using namespace std;

int main() {
   int val, sum;
   cout<<"Enter 10 numbers"<<endl;
   for(int i = 0;i<10;i++){
      cin>>val;
      sum += val;
   }
   cout<<"Sum = "<<sum<<endl;
   cout<<"Sum modulo 10 = "<<(sum%10)<<endl;
   return 0;
}

Add a comment
Know the answer?
Add Answer to:
How do you do this again? thanks in advance guys Take as input 10 integers from...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello, can you please show me how to do this program with COMPLETE INPUT VALIDATION so...

    Hello, can you please show me how to do this program with COMPLETE INPUT VALIDATION so the computer tells the user to enter ints only if the user enters in floating point numbers or other characters? Write a method called evenNumbers that accepts a Scanner reading input from a file containing a series of integers, and report various statistics about the integers to the console. Report the total number of numbers, the sum of the numbers, the count of even...

  • JAVA Ask the user for integers. If the user did not enter an integer, ask again....

    JAVA Ask the user for integers. If the user did not enter an integer, ask again. (Type Safe Input) Keep a running total of the intergers entered (sum). Once the user enters 0, stop looping. Print the sum of all the numbers. Do not use try-catch. EXAMPLE OUTPUT: Enter an integer, 0 to stop> [fasdfsa] Invalid input. Enter an integer, 0 to stop> [231.342] Invalid input. Enter an integer, 0 to stop> [1] Enter an integer, 0 to stop> [2]...

  • Write a program that first gets a list of integers from input. The input begins with...

    Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75 The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75....

  • This program will take advantage of methods written in the Help.java class First, you will write...

    This program will take advantage of methods written in the Help.java class First, you will write a new method in Help.java. This method will be named: addArray) and will accept an array of integers as input. This method will calculate the sum of all values in the array and return the resulting sum. Remember that the array being passed to the method may be of ANY length. (Use the existing methods in the Help.java class to help you remember how...

  • Can u guys hlep me answer each of those questions please Thanks in advance. could you...

    Can u guys hlep me answer each of those questions please Thanks in advance. could you guys do them step by step and explain which rules u guys are used as you guys are doing the problems. please. (9) Find the derivative of each of the following: (a) y = 3,5-1 – VI + V2 (d) y = sin-(In x) (8) y = In V272422+3 In 2x – 1 x2 + 2x + 3 (j) y=7" + x1 (b) -...

  • Hi guys just starting out programming and my professor doesn't really explain it that much can...

    Hi guys just starting out programming and my professor doesn't really explain it that much can you help me with this lab of mine in c++ and yes I'll give you points for it thank you! Lab #1 /Part A: //Input number 1 (store in var1) //Input number 2 (store in var2) //Swap them, so number 1 is in var2 and number 2 is in var1 //Output the numbers to stdout (cout) //Multiply var1 by 2 //Divide var2 by 2...

  • IN JAVA Write a program that first gets a list of integers from input. The input...

    IN JAVA Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75...

  • Coral Language Please to thanks Write a program that first gets a list of 5 integers...

    Coral Language Please to thanks Write a program that first gets a list of 5 integers from input. Then, get another value from the input, and output all integers less than or equal to that value. Ex: If the input is 50 60 140 200 75 100, the output is: 50 60 75 For coding simplicity, follow every output value by a space, including the last one. Then, output a newline. Such functionality is common on sites like Amazon, where...

  • In java, write a program that gets 10 integer numbers from the user using user input,...

    In java, write a program that gets 10 integer numbers from the user using user input, and then calculates and display the sum of the numbers that have been read.   Program Requirements: Write the program in three versions with three loops. Put all three loops in the main method of your source code. version1:  use a while loop. version2:  use a do-while loop. version 3:  use a for loop. For each version, use a loop to input 10 int numbers from the user...

  • Sum of A1l Integers in a List (SUM) Input A list of integers Ala.. b] Output...

    Sum of A1l Integers in a List (SUM) Input A list of integers Ala.. b] Output : s-Σ-, A[i] Let S(Ala...b]) represent the output of the SUM problem on input Ala..b 4 points) 5. Statetwo different elf-reductions for the SUM problem. Usethe self-reduction examples from lecture as a guide. (4 points) 6. Give recursive algorithms based on your divide and conquer self-reductions to solve the SUM problem. (2 points) 7. What are the worst case runtimes of the solutions you...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT