0% found this document useful (0 votes)
16 views

Lab Assignment - No - 5-1

This document contains an assignment with 7 questions for a Computer Programming Lab course. The questions involve writing C++ programs to: 1) Print the multiplication table of a number up to 10 using a while loop. 2) Display various patterns using loops. 3) Find the factorial of a number using a do-while loop. 4) Perform math operations like addition, subtraction, etc. based on a character input. 5) Check if a 3-digit number is a palindrome. 6) Calculate student marks and average marks per subject using a function. 7) Find the maximum of 3 numbers using a ternary operator.

Uploaded by

vaidehibhat26
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Lab Assignment - No - 5-1

This document contains an assignment with 7 questions for a Computer Programming Lab course. The questions involve writing C++ programs to: 1) Print the multiplication table of a number up to 10 using a while loop. 2) Display various patterns using loops. 3) Find the factorial of a number using a do-while loop. 4) Perform math operations like addition, subtraction, etc. based on a character input. 5) Check if a 3-digit number is a palindrome. 6) Calculate student marks and average marks per subject using a function. 7) Find the maximum of 3 numbers using a ternary operator.

Uploaded by

vaidehibhat26
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

IC151: Computer Programming Lab

Autumn Semester 2023


Assignment 5

Q.1 Write a C++ program that takes a number as input and prints its multiplication table up to 10 using a while
loop.

Q.2 Write a C++ program to display the following pattern.


a) 1 b) *
1 2 * *
1 2 3 * * *
1 2 3 4 * * * *
1 2 3 4 5 * * * * *

Q.3 Write a C++ program that reads an integer from the user and finds its factorial using a do-while loop.

Q.4 Accept two integer numbers from the user. Accept a character input from the user ('A' or 'S' or 'M' or 'D'
or ‘R’). Check whether only the following characters have been entered. Based on this input, perform
either Addtion, Subtraction, Multiplication, Division, and remainder of the two numbers using switch case.

Q.5 Enter a 3-digit integer number. Check whether the number entered is a palindrome or not. A palindrome
is a number that will read the same from left to right or right to left. E.g. 121, 242, and 676 are examples
of a 3-digit palindrome number. 123, 211, 345, and 322 are examples of numbers that are not palindrome.

Q.6 Write a program that takes the marks of 10 students as input and also takes the subject as input. It
calculates the total marks of each student and the average of individual subjects using a function.

Q.7 Write a C++ program to find the maximum number from any three integers using a ternary operator.

You might also like