Lab 1 Tasks (Revision)
Lab 1 Tasks (Revision)
1. Write a function that takes two numbers as argument and finds the value of one
number raised to the power of another.
1*1
2**2
3***3
4****4
5*****5
3. Write a function that reads in 5 numbers; stores them in an array and calculates and the
number of odd and even numbers. If user enters 0, it should not be counted.
5. Write a function that sums the value of all elements in an array. Display the Average
also.
6. Write two functions to find the lowest and highest value from an array. Array should be
filled by user.
7. Write a function that Asks the user to enter the assessment of their telephone service.
Take Input from 50 users and store in a 1 D array. Now calculate and display how
many users rated the system Excellent, Good, Average, Below Average and Poor.
8. The Internet and the web are enabling more people to interconnect, join a cause, voice
opinions, and so on. In this program, you’ll write a simple polling program that allows
users to rate five social-consciousness issues from 1 (least important) to 10
(most important).
Pick five causes that are important to you (e.g., political issues, global environmental
issues). Use a one-dimensional array topics (of type String) to store the five causes.
To summarize the survey responses, use a 5-row, 10-column two-dimensional array
responses (of type int), each row corresponding to an element in the topics array and
each column represents the responses given by a person.
(Responses will be taken from ten persons)
When the program runs, it should ask the user to rate each issue. Store the responses in
the two-dimensional array. Now the program should display a summary of the results,
including:
9. Write a function that replaces T with O in the String given below: (2.5)
WelcTme tT TutTrialspTint.cTm
Return the modified string to main.
10. Write a function that asks the user to enter an email address. Extract the username
from the email address and return it to main.
e-g if user enters [email protected] , the function should return “student”.