The document lists 15 programming problems involving basic math operations, conditional statements, loops, and patterns using stars. The problems include writing programs to check if a number is a perfect square, make a simple calculator, check if a character is alphabetic, convert cases of letters, check if one number is a multiple of another, calculate heating times based on water temperature, add floating numbers and find the floor of the sum, check if a number is prime, display the English alphabet, calculate power of a number, reverse a number, and display half pyramids, full pyramids, and an X-shape using stars.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
20 views3 pages
Extra Problems On Lec
The document lists 15 programming problems involving basic math operations, conditional statements, loops, and patterns using stars. The problems include writing programs to check if a number is a perfect square, make a simple calculator, check if a character is alphabetic, convert cases of letters, check if one number is a multiple of another, calculate heating times based on water temperature, add floating numbers and find the floor of the sum, check if a number is prime, display the English alphabet, calculate power of a number, reverse a number, and display half pyramids, full pyramids, and an X-shape using stars.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
Extra problems Lec(2)
(1) Write a program that reads a positive integer and
checks if it is a perfect square.
(2) Write a program to make a simple calculator using
switch-case. The calculator takes the operation (+ or – or * or /) and takes the two input arguments and print the results.
(3) Write a program that takes one character and checks if it
alphabet or not.
(4) Write program that converts any letter from
lowercase to uppercase.
(5) Write a program that reads two integers and checks if the first is multiple of the second.
(6) Write a program that calculates the required heater
activation time according to the input temperature of water. - if input temperature is from 0 to 30, then required heating time = 7 mins. - if input temperature is from 30 to 60, then required heating time = 5 mins. - if input temperature is from 60 to 90, then required heating time = 3 mins. - if input temperature is more than 90, then required heating time = 1 mins. - if temperature is invalid (more than 100), display "Invalid input" Example: Input = 10 → output = 7 Input = 35 → output = 5
(7) Write a program to add two floating numbers. Determine
the integer floor of the sum. The floor is the truncated float value, anything after the decimal point is dropped.
(8) Write a program that reads a positive integer and
checks if it is a prime number.
(9) Write a program to display English alphabets from A to Z.
(10) Write a program to calculate the power of a number.
The number and its power are input from user.
(11) Write a program to reverse a number.
(12) Write a program to display half pyramid using stars pattern.
* ** *** **** ***** (13) Write a program to display inverted half pyramid using stars pattern. ***** **** *** ** * (14) Write a program to display a full pyramid using stars pattern. * *** ***** ******* ******** (15) Write a program to display cross or X-shape using stars pattern. * * * * * * * * * * ** ** * * * * * * * * * *