Uploaded by Aqdas Siddiqui

Assignment 01

advertisement
PAF- KARACHI INSTITUTE OF ECONOMICS & TECHNOLOGY
Department of Mechatronics Engineering
Introduction to Computer Programming
Assignment # 1
Class ID: 103247
Total Marks: 40
Date: Thursday, 06th February 2020
Due Date: Monday, 17th February 2020
____________________________________________________________________________________
CLO_1: [PLO_12: Lifelong Learning – Cognitive Level C1: Knowledge]
Problem 01: Show how C will solve the following equation and what will be the final value of c?
int a = 6, b = -3, c = 2;
c = a + b / c * (4 + a / 2 / (b+5)) - (a – b);
CLO_1: [PLO_12: Lifelong Learning – Cognitive Level C1: Knowledge]
Problem 02: Write equivalent C code for the following flow chat. Also determines the final value of
variable a if initial value of a is 150.
Page 1 of 2
(CLO_2): (C2 i.e., Understand) (PLO_1, i.e., Domain knowledge)
Problem 03: Write a program that asks user to enter values for the double variables (vo, a, x, x0) in the
following formula. It then computes the velocity and prints it with three digits after .
velocity  vo2  2a( x  xo)
(CLO_2): (C2 i.e., Understand) (PLO_1, i.e., Domain knowledge)
Problem 04: (Calculating the cost) Suppose you transfer $N and bank’s charge occurs as follows.
$10

$10  2% of N
cos t  
$15  0.1% of N

$30
if N  $500
if 500  N  1000
if 1000  N  10000
Otherwise
Write a program that reads N and computes cost.
Page 2 of 2
Download