Question

4. Write a program, to sum up, the first 200 integer values starting from 1.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python language code :-

# sum of first 200 numbers

start =1
sum_variable =0
for start in range(1,201):          # including 200 also in range function
   sum_variable += start
print("{}{}".format("sum is : ",sum_variable))
   

Add a comment
Answer #2

#include<stdio.h>

main()

{

int i,sum=0;

for(i=1;i<=100;i++)

{

sum=sum+i;

}

printf(“Sum of nos 1 to 100 =%d”,sum);

}

source: www.tanzaniawire.com
answered by: wizzymax
Add a comment
Know the answer?
Add Answer to:
4. Write a program, to sum up, the first 200 integer values starting from 1.
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
  • Write a program that reads two integer values. It then calculates and displays the sum and...

    Write a program that reads two integer values. It then calculates and displays the sum and average of all values between them, Le. if the first value is vi and the second value is 2, then the program calculates and displays the sum and average of all values in the closed range Iv1,2 Your Program must satisfy the following constraints: A. make sure that v1 is less than 2 B. Use a function named getStats(that takes two integer yalues as...

  • Write a Java program that inputs a list of integer values in the range of −...

    Write a Java program that inputs a list of integer values in the range of − 1 to 100 from the keyboard and computes the sum of the squares of the input values. This program must use exception handling to ensure that the input values are in range and are legal integers, to handle the error of the sum of the squares becoming larger than a standard Integer variable can store, and to detect end-of-file and use it to cause...

  • Sum of Numbers Problem: Write a method that accepts an integer argument and returns the sum...

    Sum of Numbers Problem: Write a method that accepts an integer argument and returns the sum of all the integers from 1 up to the number passed as an argument. For example, if 50 is passed as an argument, the method will return the sum of 1, 2, 3, 4, . . . 50. Use recursion to calculate the sum. Demonstrate the method in a program. The program should be called SumOfNumbers.java.

  • C++ coding answer 5. Write a program that asks the user for a positive integer value....

    C++ coding answer 5. Write a program that asks the user for a positive integer value. The program should use a loop to get the sum of all the integers from 1 up to the number entered. For example, if the user enters 50, the loop will find the sum of 1, 2, 3, 4, ... 50. Input Validation: Do not accept a negative starting number.

  • Write a C++ program to read an unknown number of integer values and find the sum...

    Write a C++ program to read an unknown number of integer values and find the sum of only negative integers. Use variable n to store the user input. Hint: Check Example6E.cpp (Lecture 6) Note: Use the "Check" button to verify your answer. You can modify your code and check until you get it right. For example: Test Input Result -11 A list of integers -10 12 1 14 -1

  • *Coral Language* Write a program that first gets a list of six integers from input. The first five values are the intege...

    *Coral Language* Write a program that first gets a list of six integers from input. The first five values are the integer list. The last value is the upper threshold. Then output all integers less than or equal to the threshold 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. Such functionality is common on sites like...

  • Write a program that first reads an integer for the array size, then reads double values...

    Write a program that first reads an integer for the array size, then reads double values into the array, and displays the number of values greater than the average. Enter array size: 6 Enter a number: 1.1 Enter a number: 2.2 Enter a number: 3.4 Enter a number: 3.9 Enter a number: 5.5 Enter a number: 8.75 The number of values greater than the average is 2

  • Programming in C: Write a program that accepts an integer and two floating-point values and prints...

    Programming in C: Write a program that accepts an integer and two floating-point values and prints the sum of these values. Example: Input:12,13.14,6.7; Output:31.84. Use formatted I/O

  • Write a program that generates an array filled up with random positive integer number ranging from...

    Write a program that generates an array filled up with random positive integer number ranging from 60 to 100, and display it on the screen. After the creation and displaying of the array, the program displays the following: [R]everse [A]dd [S]earch E[xit] Please select an option:_ Then, if the user selects: - R (lowercase or uppercase): the program displays the reversed version of the array. - A (lowercase or uppercase): the program displays the sum of the elements of the...

  • Write a program in c++ that prompts for an integer greater than one that represents the...

    Write a program in c++ that prompts for an integer greater than one that represents the low end of a range and a second integer greater than or equal to the first integer that represents the high end of a range. The program will print the factors (starting from 1) of integers in this range. For example, if the user enters 2 for the low end of the range and 6 for the high end of the range, then the...

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