PF Assignment 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Programing Assignment

1. This is individual assignment.


2. First think - then do: Use your brains before using your pen.
3. If your solution is smelled cheated you will be penalized with zero marks.
4. Assume the appropriate data types for the input
5. Write C# Code for each Problem on paper as well as on visual studio.
6. Printouts are not acceptable, assignments should be hand written.

1. Take Initial Velocity, time and acceleration from user, convert and save them in
respective data types and calculate Final Velocity as per following formula:

Final Velocity = Initial Velocity + (Acceleration . Time)

2. Take distance and time from user, convert and save them in respective data types and
calculate speed as per following formula:

Speed = Distance / Time

3. Take Initial Velocity, final Velocity and time from user, convert and save them in
respective data types and calculate acceleration as per following formula:

Acceleration = (Final Velocity – Initial Velocity) / Time

Page 1
4. Take mass and velocity from user, convert and save them in respective data types and
calculate kinetic energy as per following formula:

Kinetic Energy = (1/2) . Mass . Velocity2

5. Take initial Velocity, time and acceleration from user, convert and save them in
respective data types and calculate distance per following formula:

Distance = (Initial Velocity . Time) + { 1/2 . (Acceleration . Time 2) }

6. Take initial velocity and final velocity from user, convert and save them in respective
data types and calculate average velocity per following formula:

Average Velocity = (Initial Velocity + Final Velocity) / 2

7. Take value of mass of body one (m1) and mass of body two (m2) from user, convert and
save them in respective data type and calculate reduced mass per following formula:

Reduced Mass = (m1 . m2) / (m1 + m2)

8. Make a program where it is asked form user to enter total amount, you have to answer
how much Zakat to be paid on that amount. Zakat is the 2.5% of the total amount.

9. Make a program that ask user to enter temperature in Fahrenheit and you have to
convert that into Celsius

Celcius = (Fahrenheit - 32) . (5/9)

10. Write a program that will tell you how many meters are there in a mile. Where mile is
supposed to be input by user.

11. Write a program that will calculate area of circle, where value of π is 3.142

Area of circle ¿ π .r 2

12. Write a program that will calculate area of TRAPEZOID

Area of trapezoid = 1/2 . (base1 + base2) . height

13. Write a program that will calculate area of triangle:

Area of triangle = 1/2 . base . height

Page 2
14. If the marks obtained by a student in five different subjects are input through the
keyboard, find out percentage marks obtained by the student. Assume that the
maximum marks that can be obtained by a student in each subject is 100.

15. Nabeel’s basic salary is input through the keyboard. His dearness allowance is 40% of
basic salary, and house rent allowance is 20% of basic salary. Write a program to
calculate his gross salary.

16. The distance between two cities (in km.) is input through the keyboard. Write a program
to convert and print this distance in meters, feet, inches and centimeters.
1 km = 1000 meters
1 km = 3280.8399 feets
1 km = 39370.078 inches
1 km = 100,000 meters

17. If a five-digit number is input through the keyboard, write a program to calculate the
sum of its digits.

18. In a town, the percentage of men is 52. The percentage of total literacy is 48. If total
percentage of literate men is 35 of the total population, write a program to find the
total number of illiterate men and women if the population of the town is 80,000.

19. A cashier has currency notes of denominations 10, 20, 50 and 100. If the amount to be
withdrawn is input through the keyboard in hundreds, find the total number of currency
notes of each denomination the cashier will have to give to the withdrawer.
Example:
Enter Amount: 780
Hundred note: 7
Fifty note: 1
Twenty note: 1
Ten note: 1

20. If the total selling price of 15 items and the total profit earned on them is input through
the keyboard, write a program to find the cost price of one item.

21. A number is taken input from the user, Write a program to determine if it is an odd
number or an even number.

22. If a four-digit number is input through the keyboard, write a program to obtain the sum
of the first and last digit of this number.

Page 3

You might also like