Practice Questions
#
OverviewPrint your name
my_name.cpp
Print your name, age, hobbies
bio.cpp
#
VariablesCreate a variable to store your favourite number and print it
fav_num.cpp
Create variables to store your name, favourite number and print it
fav_num.cpp
Swap values of two variables
swap_values.cpp
tip
Swap the values of two variables without using third variable
swap_values2.cpp
#
Input/OutputTake input of favourite number and print it on screen
numInput.cpp
Take full name of user and age of user as inputs and print them
stringInput.cpp
#
ConditionalsCheck the given number is odd or even and print
odd_even.cpp
Largest among three numbers
largest3.cpp
check whether the triangle formed by the given sides(inputs) is equilateral, isosceles, or scalene.
triangle.cpp
Given coefficients of a quadratic equation , you need to print the nature of the roots (Real and Distinct , Real and Equal or Imaginary) and the roots.If Real and Distinct , print the roots in increasing order.
If Real and Equal , print the same repeating root twice
If Imaginary , no need to print the roots.
Note : Print only the integer part of the roots.
quadratic_equation.cpp
#
Loopstip
Check out for pattern questions on GeeksForGeeks or Here
Read N numbers and print their average. HINT: You would be given first N, and then N integers of the list.
average.cpp
Given a number check if it is a member of Fibonacci sequence or not?
is_Fibonacci.cpp
Given a number N, find sum of its digits
sum_of_digits.cpp
#
PatternsPrint the following pattern (square)
- Input
- Output
n = 5
pattern.cpp
Print the following pattern (Rectangle)
- Input
- Output
row = 4 col = 7
pattern.cpp
Print the following pattern (Hollow Rectangle)
- Input
- Output
row = 4 col = 8
pattern.cpp
Print the following pattern
- Input
- Output
n = 6
pattern.cpp
Print the following pattern
- Input
- Output
n = 5
pattern.cpp
Print the following pattern (Floyd's Triangle)
- Input
- Output
n = 5
pattern.cpp
Print the following pattern (Half Pyramid after 180°)
- Input
- Output
n = 5
pattern.cpp
Print the following pattern (Inverted Half Pyramid)
- Input
- Output
pattern.cpp
Print the following pattern (0-1 pattern)
- Input
- Output
pattern.cpp
Print the following pattern (Rhombus)
- Input
- Output
pattern.cpp
Print the following pattern (Pyramid Numbers)
- Input
- Output
pattern.cpp
#
FunctionsWrite a function to reverse the given number N as input.
reverse_num.cpp