Programming Assignment 2: Instructions and Examples, Exercises of Computer Engineering and Programming

Instructions and examples for a programming assignment, including tasks such as finding the smallest number, calculating sum and percentage, swapping values, and performing arithmetic operations based on user input. The deadline for submission is december 22, 2011, before 11pm.

Typology: Exercises

2011/2012

Uploaded on 07/13/2012

ekvir
ekvir 🇮🇳

4

(1)

35 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Programming Assignment no 2:
1. Take three numbers and print the smallest using any of the if statement. If neither
number is smallest then print that numbers are equal
2. Take FOUR variables, 1st for name, 2nd for English marks, 3rd for physics marks and 4th
for introduction to computing marks. Take values in these variables from user. Then
calculate the sum and percentage.
Then after printing the above all things
Suppose user enters 80, 70, 80 then your output will looks like this
Enter name xyz
Enter English marks 80
Enter physics marks 70
Enter introduction to computing marks 80
Marks in English is 80
Marks in physics is 70
Marks in introduction to computing is 80
Sum is 230
Percentage is 76
3. Take two values as input from user. Swap the two values by using third variable.
Suppose user enter 1 for 1st value and 2 for 2nd value.
Output should be:
Enter 1st value
Enter 2nd value
First value is 2
Second value is 1
4. Take two integer type values from user. Take operator of character type as input from
user. If user enters +, perform addition of the above two integer type inputs. If user
enters -, perform subtraction of the above two integer type inputs. If user enters *,
perform multiplication of the above two integer type inputs else perform division of the
above two integer type inputs.
Deadline: 22 December 2011 before 11pm
Copy cases will be given zero marks. Those who have used same logics will also be given
zero marks.
Good luck
docsity.com

Partial preview of the text

Download Programming Assignment 2: Instructions and Examples and more Exercises Computer Engineering and Programming in PDF only on Docsity!

Programming Assignment no 2:

  1. Take three numbers and print the smallest using any of the if statement. If neither number is smallest then print that numbers are equal

  2. Take FOUR variables, 1st^ for name, 2nd^ for English marks, 3rd for physics marks and 4 th for introduction to computing marks. Take values in these variables from user. Then calculate the sum and percentage. Then after printing the above all things Suppose user enters 80, 70, 80 then your output will looks like this Enter name xyz Enter English marks 80 Enter physics marks 70 Enter introduction to computing marks 80 Marks in English is 80 Marks in physics is 70 Marks in introduction to computing is 80 Sum is 230 Percentage is 76

  3. Take two values as input from user. Swap the two values by using third variable. Suppose user enter 1 for 1st^ value and 2 for 2nd^ value. Output should be: Enter 1st^ value Enter 2nd^ value First value is 2 Second value is 1

  4. Take two integer type values from user. Take operator of character type as input from user. If user enters +, perform addition of the above two integer type inputs. If user enters - , perform subtraction of the above two integer type inputs. If user enters *, perform multiplication of the above two integer type inputs else perform division of the above two integer type inputs. Deadline: 22 December 2011 before 11pm Copy cases will be given zero marks. Those who have used same logics will also be given zero marks. Good luck

docsity.com