ComputerProgramming HW 02 Solution



Prepare your homework 02 without using array. If you use, the grade will be zero.

1. (50 Points)

Write a C program that takes the number of the students from keyboard between 3 and 50. After taking a number of the students, you must generate a random grade for each student (the number of the grades is equal to the number of the students). The grade is between 0 and 100. After the grades are generated, the program displays a menu which is shown below. The menu consist of 5 options:

  1. Show most successful student,

  1. Show most unsuccessful student,

  1. List the number of students for each letter grade,

  1. Show all four options data.

Options should give same results as in the figures and letter grades must be calculated programmatically according to grade scale which shown in table below. The program won’t close or restart after any option selection until user enter -1 on menu selection. Also, the menu is shown after every selection.

Note: You must use switch cases to construct the menu. Use rand(void) function to create rando m grades. Take as “srand(40) ;”.


Letter Grade

90-100 A

80-89 B

70-79 C

60-69 D

0-59 F

lu784343hwt9 tmp ef8d9a7e371e2c16

lu784343hwt9 tmp d96a79fe175e5bf2

  1. (50Points)

Write a C program to find all digits of a number which is entered from the keyboard (the number must be between 23 and 98760). The program screen is shown in below. Do not use #include <stdlib.h>.

You can only use #include .

If you use other library header files, your grade will be zero. Enter the number: 79045

The fifth digit is 7

The fourth digit is 9

The third digit is 0

The second digit is 4

The first digit is 5


  1. Obey honor code principles.

  1. Read your homework carefully and follow the directives about the I/O format (data file names, file formats, etc.) and submission format strictly. Violating any of these directives will be penalized.

  1. Obey coding convention.

4. Your submission is and include the following files and

NOTHING MORE (no data files, object files, etc):

    • HW02part1.c

    • HW02_<student_name>_<studentSurname>_<student number>_part2.c

    • HW02_<student_name>_<studentSurname>_<student number>.pdf (includes some programming screens and any details of part 1 and part 2, separately).

  1. Do not use non-English characters in any part of your homework (in body, file name, etc.).

  1. Deliver the print out of your work until the last submission date.

  2. For questions about homework, you can send an email to