0% found this document useful (0 votes)
255 views2 pages

C++ Programms Task

This document provides 50 programming problems or exercises to practice C++ programming concepts and skills. The problems cover a wide range of fundamental programming topics like input/output, arithmetic operations, conditional statements, loops, functions, arrays, strings and more. Solving these problems will help develop proficiency in writing C++ programs to solve computational and logical problems.

Uploaded by

Nabh Agrawal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
255 views2 pages

C++ Programms Task

This document provides 50 programming problems or exercises to practice C++ programming concepts and skills. The problems cover a wide range of fundamental programming topics like input/output, arithmetic operations, conditional statements, loops, functions, arrays, strings and more. Solving these problems will help develop proficiency in writing C++ programs to solve computational and logical problems.

Uploaded by

Nabh Agrawal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

C++ PROGRAMS (Practical Lab)

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.

Write a program to calculate the sum, subtraction, multiplication and division of two numbers.
Write a program that accepts radius of a circle and prints its area and perimeter.
Write a program that accepts marks in 5 subjects and outputs average marks.
Write a program that reads temperature in Celsius and displays it in Fahrenheit. (F = (1.8*C)+32 )
Write a program that inputs a students marks in three subjects and print the percentage of marks.
Write a program to input an integer and display its first three multiples.
Write a program to compute the area of a square.
Write a program that accepts a character and prints next 4 characters.
Write a program to find the area of a triangle.
Write a program to read two numbers and print their quotient and remainder.
Write a program to compute simple interest.
Write a program that accepts height in centimeters and then converts height to feet and inches.
(1foot=12inches, 1 inch=2.54cm).
A computer programming contest requires teams of 5 members each. Write a program that accepts
numbers of players, and then give the number of teams and number of players left over.
Write a program which will raise any number x to a positive power n. Accept values of x and n
from user.
Write a program to input principal amount and time. If time is more than 10 years, calculate the
simple interest with rate 8%, otherwise calculate it with rate 12% per annum.
Write a program to input a number. If the number is even, print its square otherwise print its cube.
Write a program to input three integers and print the largest of three.
Write a program to accept two numbers and an operator. The program performs the arithmetical
operation and display the result.
Write a program to print whether a given character is an uppercase or a lowercase character or a
digit or any other character. (using if-else)
Characters
0 to 9
A to Z
a to z
other characters

ASCII Range
48-57
65-90
97-122
0-255 other than above

20. Write a program to calculate area of circle, area of a rectangle or a triangle depending upon users
choice. (using switch case)
21. Write a program to print first n natural numbers and their sum.
22. Write a program to calculate the factorial of an integer.
23. Write a program to calculate and print the sum of even and odd integers of the first n natural
numbers.
24. Write a program to check whether a number prime or not.
25. Write a program to check whether a number is palindrome or not.
26. Write a program to print table of a given number.
27. Write a program to find whether a year is a leap year or not.
28. Write a program to print Fibonacci series i.e. 0 1 1 2 3 5 8 13 21.
29. Write a program to accept a list of numbers and print largest even number and largest odd number.
30. Write a program to produce the following designs:
A
*
A
B
*
*
A
B
C
*
*
*
A
B
C
D
A
B
C
D
E
* * * *
* * * * *
31. Write a program to count number of spaces in a string. (using library function)
32. Write a program to count number of lowercase and uppercase characters in a string. (using library
function)
33. Write a program to compare length of two strings.
34. Write a program that checks whether the given character is alphanumeric or an alphabet or a digit.
(using library function)
35. Write a program that reads a string and convert it into uppercase. (using library function)
Prepared By: Nabh Agrawal

C++ Programs

Page |1

36. Write a program that reads two strings and appends (join) the first string to the second. (using
library function)
37. Write a program that reads two strings and copies the smaller string into bigger string. (using
library function)
38. Write a program to print cube and square root of a given number using a function.
39. Write a program to swap two numbers using call by value and call by reference method.
40. Write a function to take an integer argument and return 0 if the given number prime otherwise
return -1.
41. Write a program to read price of 20 items in an array and then display sum, product and average of
all the prices.
42. Write a program to check if a string is palindrome or not.
43. Write a program to replace every space in a string with a hyphen (-).
44. Write a program to convert a string to proper case. (Capitalize first letter of each word)
45. Write a program to print the sum of each column of a two dimensional array.
46. Write a user defined function to display those elements of a 2-D array, which are divisible by 10.
47. Write a program to reverse a string.
48. Write a function that takes a double array name and an array size as arguments and that swaps the
first and last value in that array.
49. Write a function Change(int P[], int N) which should change all the multiples of 10 in the 1-D array to
10 and rest of the elements as 1.
50. Write a program to record score of a cricket match. One array stores information of batting team
such as batsmans name, runs scored, total over and extras. The other array stores information
about bowling team such as bowlers name, over bowled, maiden over, runs given and wicket
taken. Depending upon the users choice, the program displays either the batting team information
or the bowling team information.

$***Best Wishes***$

Prepared By: Nabh Agrawal

C++ Programs

Page |2

You might also like