Coding Exercises
Coding Exercises
Coding Exercises
“Talent wins games, but teamwork and intelligence win championships. - Michael Jordan”
3: Write a program with three variables then initialize them to 10, 15, and
12.6. It then prints these values from the lowest to highest.
5: Write a program that will prompt the user to input 3 integer values and
print these values in forward and reversed order, sample display as shown
below:
6. Create a program that will add two numbers together and display the
result.
7. Ask the user to input three values of resistors (ohms) connected in parallel
and compute the total resistance of the circuit. Display the values of the
resistors and its total resistance.
8. Prompt the user to enter the username and password of her/his account. If
both details are correct, display “Welcome to ECE Department!”. If not, put
“Sorry you are not from ECE Department.”
10.: Write program that reads two numbers and multiplies them together and
print out their product.
11: Create a program that will enter the grades of Science, Math and English.
If the grades are:
Science >= 85
Math >=87
English>=90
Display: “Congratulations, you are qualified to apply in Electronics Engineering!”
If not, display” Sorry, you may try the other programs.”
12: Write a program that performs the following: Ask a user to enter a
number. If the number is between 0 and 10, write the word blue. If the
number is between 10 and 20, write the word red. if the number is
between 20 and 30, write the word green. If it is any other number,
write that it is not a correct color option.
13: Design a program that prints all multiples of 5 between 1 and 100
(including both 1 and 100).
14: Write a program that will count all the even numbers up to a user defined
stopping point.
16. Input 3 numbers and print either an "all 3 are equal" or a "not all are
equal" message. Show also the entered numbers.
21. Ask the user to input three values of resistors (ohms) connected in parallel
and the supply voltage in volts. Compute the total current of the circuit.
Display the values of the resistors, supply voltage and its total current.
22. Ask the user to input three values of resistors (ohms) connected in parallel
Compute the total conductance of the circuit. Display the values of the
resistors, and its total conductance.
23. Ask the user to enter her/his atm card and put her/his pin number. If both
are accepted, print “Choose your transaction: “. If one of them is not
accepted, display “Please try again.” She/He may only have three attempts to
use her/his account.
24. Design a program that will ask the user to answer questions (5 questions
only related to PLC). If the user answered the previous question correctly,
she/he may proceed to the next one. If not, print “Sorry you may not proceed
to the next number.” Last display output is the score she/he got from the test.
25. Design a program that will ask the user to answer questions (5 questions
only related to C). Last display output is/are the numbers that was answered
correctly and those that are not answered correctly.
26. Design a program that will ask the user to answer questions (5 questions
only related to Raptor). If the total score is equal to five, put” Excellent”, if
the score is equal to 4, display “Very good”, if the score is equal to 3, print
“Good”. If it is 2-0, display “Sorry, you have to repeat the subject.”
27. Prompt the user to enter her/his name and favorite color. Color and
attitude are as follows:
Red – bold
Green – calm
Yellow – happy
Other colors – have no attitude review
Sample Display:
Name: Kaori
Favorite Color: Yellow
Sample display:
Temperature: 42
Air Pressure: 15
Aircon: ON
29. Develop a program that will prompt the user to enter the voltage and
current requirements of the equipment and determine the power consumption
of the equipment:
Sample Display:
Equipment: PLC
Voltage Requirement: 24 volts
Current Requirement: 0.4 A
Power Consumption: 9.6 W
30- 31. Ask the user to enter the power rating of the appliances and the
number of hours it has been used in a month (use only 3 appliances) .
Calculate the electricity consumption and the amount to be paid. Per KwH =
Php 12.00
Sample Display:
1 Television: 200 W
KwH: 22.4
1 Refrigerator: 250 W
KwH: 180
1 Electric Fan: 60 W
KwH 6.72
Total KwH: 209.12
Amount to Pay: 2509.44