Question: Write a program that, given an integer N N , sums all the whole numbers from 1 through N N ( both inclusive ) .

Write a program that, given an integer
N
N, sums all the whole numbers from 1 through
N
N (both inclusive). Do not include in your sum any of the intermediate values (1 and
N
N inclusive) that are divisible by 5 or 7.
Input:
Your program should read lines from standard input. Each line contains a positive integer.
Output:
For each line of input, print to standard output the sum of the integers from 1 through n, disregarding those divisible by 5 and 7. Print out each result on a new line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!