1. Elementary Programing Language with C Assignment
Class : C0510H Date: 19/12/2005
Duration : 120 minutes
Rule : Student creates Folder with TestC name in D Driver (D:TestC)
- Question1 can be saved with file name q1.c
- Question2 can be saved with file name q2.c
- Question3 can be saved with file name q3.c
If this rule is violated, all file will be ignore.
Question 1 : Create a program as follow :
Input N as an integer number. Check this number is a squarer of an integer
number or not? (N=k2
) If it is, please print k in the screen.
Question 2 : Create a program with menu as follow :
1. Input an array
2. Modify an array element
3. Find maximum odd number
4. Summary all elements of the array
5. Summary all even elements of the array
6. Summary all prime elements of the array
7. Exit
Your choice :
If customer choose 1, the program should clear screen and the program run as follow :
- Allow customer input the number N (N<=300) of elements of this array
- Then, input all N elements of this array
- Then, return back to the menu
If customer choose 2, the program should clear screen and the program run as follow :
- Allow customer input the index of the array element that customer want to modify.
(Assum that index of the array start with 1 and end with N).
- Then, customer input the new value for this element.
- Then, return back to the menu
If customer choose 3, the program should clear screen and the program run as follow :
- Find and print the value of the elements that is odd number and is the highest number of
this array.
- Then, return back to the menu
If customer choose 4, the program should clear screen and the program run as follow :
- Print the summary of all elements in this array.
- Then, return back to the menu
If customer choose 5, the program should clear screen and the program run as follow :
- Print the summary of all elements that is even number in this array.
- Then, return back to the menu
If customer choose 6, the program should clear screen and the program run as follow :
2. - Print the summary of all elements that is prime number in this array.
- Then, return back to the menu
If customer choose 7, the program will be exit.
Question 3: Input N (N<=25 and N is odd number). Print the N row in screen as follow :
Example :
With N = 3
***
*
***
With N = 5
*****
***
*
***
*****