Assignment # 1 PF3824723hhh2834
Assignment # 1 PF3824723hhh2834
Campus
Course: Programming Fundamentals Course CS 118
Code:
Program: BSE-1A & BCS-1G Semester: Fall 2021
Due Date 9-OCT-2021 at 11:59 pm Total Marks: 50
Section: 1A & 1G Page(s): 3
Type: Assignment 1
Important Instructions:
1. You have to upload only .cpp file. Assignment in any other format (extension) will not be
accepted and will be awarded with zero marks. You have to make a zip file and upload it onto
the google classroom submission folder. For question 1, name your solution file with your roll
number, i.e., Q1_21L_1111.cpp. Similarly, you can name other questions.
2. You are not allowed to copy solutions from other students. We will check your code for
plagiarism using plagiarism checkers. If any sort of cheating is found, negative marks will be
given to all students involved.
3. For each passing day after deadline, 20% of the marks will be deducted. Three days after the
deadline, no submission will be accepted.
Question 1: [Marks: 5]
Write and run a program that reads a six-digit integer and prints the sum of its six digits.
Sample Input: 153426
Sample output: 21
Question 2: [Marks: 3]
Write and run a program that reads two integers and then uses the conditional expression operator to
print either “multiple” or “not” according to whether one of the integers is a multiple of the other.
Sample Input: 12 6
Output: 12 is the multiple of 6 Sample
Input: 12 13
Output: NON
Question 3: [Marks: 3]
Write a program which takes marks of 5 courses as input, of 5 students and output the students who got
the highest aggregate. Roll# C1 C2 C3 C4 C5
Sample Input: 1391 80 70 60 14 88 1376 70 80 80 88 89 1374 71 82 50 80 79 1372 77 90 90 99 100 1375
73 83 40 81 69
Sample Output: 1372 has highest Aggregate of 456
Question 4: [Marks: 7]
Write a program which takes as input 3 points and tell whether these points are the coordinates of right
angled or scalene triangle.
Sample Input: P1 0 0 P2 1 0 P3 1 1
Sample Output: Right Angle Triangle
Question 6: [Marks: 3]
Write a C++ program that takes two inputs from user; Weight in Kg and Height in meters and calculates
and outputs Body Mass Index(BMI). Formula of BMI in given below.
BMI = weight in Kg /(height in Meters) 2
Question 7: [Marks: 4]
Write a program that takes two integers A and B from the user and swap their values using a third
temporary variable.
Sample Output: Before Swapping: A = 45 B = 32
After Swapping: A = 32 B = 45
BONUS: Solve the same problem, swap the values of two integers A and B but you are not allowed to
use any extra variable other than A and B.
Question 8: [Marks: 4]
Write a C++ program to decide whether the given three numbers are pythagorean triple or not. This
means you will take three numbers as input from the user and check if any order of the number holds
the property c² = a² + b².
Question 9: [Marks: 3]
Write a C++ program to check whether a character is an alphabet, digit or special character.