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

Questions For Practice

The document contains 30 questions asking to write C++ programs that perform various tasks like finding data type sizes, calculating ASCII values, converting days to years/weeks, determining minimum/maximum numbers, checking positive/negative numbers, even/odd numbers, printing patterns using loops, calculating factorials, Fibonacci series, functions for adding, subtracting, multiplying, dividing, finding greatest common divisor, square roots, calculating volumes of spheres, building a basic calculator, and calculating averages.

Uploaded by

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

Questions For Practice

The document contains 30 questions asking to write C++ programs that perform various tasks like finding data type sizes, calculating ASCII values, converting days to years/weeks, determining minimum/maximum numbers, checking positive/negative numbers, even/odd numbers, printing patterns using loops, calculating factorials, Fibonacci series, functions for adding, subtracting, multiplying, dividing, finding greatest common divisor, square roots, calculating volumes of spheres, building a basic calculator, and calculating averages.

Uploaded by

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

Q#1 Write a program to find size of data types.

Q#2 Write a program that ask user to input a number or character and print ASCII Value in
C++.
Q#3 Write a program to convert days into years and weeks
Q#4 Write a program that ask user to input two integers and find out minimum number
Q#5 Write a program to print positive number entered by the user. If user enters negative
number, it is skipped.
Q#6 Write a program to check whether the number is less than or greater than 10 inputted by
the user.
Q#7 Write a program to check the number entered by the user is even or odd.
Q#8 Write a program to print the following pattern using do while loop.

*
**
***
****
*****
Q#9 Write a program to find Factorial Value of number given by the user, using For Loop
Q#10 Write a program that prints the following pattern
*
***
*****
*******
*********

Q#11 Write a program that prints the following pattern


*********
*******
*****
***
*
Q#12 Write a program that prints the following pattern
*
***
*****
*******
*********
*******
*****
***
*
Q#13 Write a program that continually calculates the cube of a number until the user enters a
number that is divisible by both 2 and 3.
Q#14 Write a program to find Factorial Value of number given by the user, using For Loop

Q#15 Write a program that prints the following pattern


*
***
*****
*******
*********
*******
*****
***
*
Q#16 Write a program that continually calculates the cube of a number until the user enters a
number that is divisible by both 2 and 3.
Q#17 Write a program to find Fibonacci Series of a number given by user.
Q#18 Write a program to find Fibonacci series as count given by user. ie: user enters 5 it show
first five numbers of the Fibonacci series.
Q#19 Write a program to add two integers. Make a function add() to add integers and display
sum in main() function.
Q#20 Write a program to find largest integer among the three and display it using function
Q#21 Write a program to check whether a number is prime or not using Function.
Q#22 Write a program to Reverse number using while loop in function
Q#23 Write a function which returns nothing and has two integer arguments being passed by
reference and sets the smaller of the two numbers to 0.
Q#24 Write a program by using library function to calculate square root of a number given by
user
Q#25 Write a complete application to prompt the user for the double radius of a sphere, and call
method sphereVolume to calculate and display the volume of the sphere. Use the
following statement to calculate the volume:
double volume = ( 4.0 / 3.0 ) * Math.PI * Math.pow( radius, 3
Q#26 Create the equivalent of a four-function calculator. The program should ask the user to
enter a number, an operator, and another number. It should then carry out the specified
arithmetical operation: adding, subtracting, multiplying, or dividing the two numbers. Use
a switch statement to select the operation. Finally, display the result. When it finishes the
calculation, the program should ask whether the user wants to do another calculation. The
response can be ‘y’ or ‘n’.
Q#27 Write a program to find the Greatest Common Devisor using recursion.
Q#28 Write a program that will ask the user to input ten integer values. Then it will print the
smallest and largest of those numbers using function use print format to set the distance
when showing the minimum and maximum number.

Q#29 Write a program to add two integers. Make a function add () to add integers and display
sum in main () function.
Q#30 Write a program that asks the user to type a positive integer. When the user types a
negative value the program writes ERROR and asks for another value. When the user
types 0, that means that the last value has been typed and the program must write the
average of the positive integers. If the number of typed values is zero the program writes
'NO AVERAGE'.

You might also like