Question: Write a program ( main ( ) function ) using simple nested loops that sums the even and odd numbers between 1 and 1 1

Write a program (main() function) using simple nested loops that sums the even and odd numbers between 1 and 11 and prints out the computation.
The steps are as follows:
1. Write a for loop with a range function for even numbers.
2. Write a for loop with a range function for odd numbers.
3. Use a variable called val to calculate the sum of even and odd.
4. Determine if val is a prime number
FYI: Prime numbers between a and 100 are
2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97
5. Print the two loop counters and val to the terminal and, if the sum is a prime, display "is a prime"
The output should look like (first 6 lines of output):
Name:
Student #:
2+1=3 Is a prime number
2+3=5 Is a prime number
2+5=7 Is a prime number
2+7=9
2+9=11 Is a prime number
4+1=5 Is a prime number
...

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!