EECP1290 - Computer Programming for Engineering Practical Test [10 Marks] Duration 30 + 5 Minutes Student ID: Name: Submission: E-Learning [Notepad file only] Write a C program to read Five integer numbers and find sum of positive even numbers using while or for loop. Refer Sample Output: enter one number 3 enter one number -4 enter one number 8 enter one number 7 enter one number 2 Sample Output There are 2 positive even numbers Sum of positive even numbers is 10 enter one number -6 enter one number -9 enter one number 4 enter one number 5 enter one number 7 There are 1 positive even numbers Sum of positive even numbers is 4 Marks Distribution: Input : 1 Mark Conditions and Logic : 6 Marks Output statements : 1 Mark No Errors : 1/2 Mark Comments : 1/2 Mark Correct output : 1 Mark Note: Submit Notepad file. No Images/Pictures will be accepted.
Added by Jeffrey T.
Close
Step 1
First, we need to prompt the user to enter 5 integer numbers. We can use the printf function to display a message asking the user to enter the numbers, and the scanf function to read the input from the user. Show more…
Show all steps
Your feedback will help us improve your experience
Ct Turner and 65 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a C++ program that prompts the user to enter a file name that contains the scores of students in a quiz. Each line in the input file contains a student name followed by the student's score (as shown in the sample file to the right). The program should then find out the students with the minimum score and the maximum score and display their names and scores. Marks.txt Ahmed 90 Badria 85 Noor 91 Khalid 70 Said 65 Suha 80
John B.
Write a program that will read data from the file "p6.dat". The file (that you will create) always contains 15 test scores (whole numbers between 0 and 100). The test scores are scores for 5 students taking 3 tests, and are arranged in the file by the student - that is, the first 3 numbers are the test scores for test 1, 2, and 3 for the first student, etc. The program will print: - Average per student (5 averages), on a single line, with 2 decimals - Average per test (3 averages), on a single line, with 2 decimals - Overall best score on a single line - How many scores were Fs (out of the 15, how many were at most 59) on a single line To simplify the code, no validations are needed. That is, assume the file is successfully opened, and that all data are 0-100, and that there are exactly 15 numbers in the file. Note that the program reads the filename.
Oswaldo J.
Write a C++ program that reads a file consisting of students’ test scores in the range 0–200. It should then determine the number of students having scores in each of the following ranges: 0–24, 25–49, 50–74, 75–99, 100–124, 125–149, 150–174, and 175–200. Output the score ranges and the number of students. (Run your program with the following input data: 76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189
Supreeta N.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD