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

C++ Lab Exercises

The document contains a series of C++ programming exercises focused on various concepts such as solving quadratic equations, temperature conversion, generating multiplication tables, reversing numbers, calculating harmonic series, printing patterns, and working with arrays and strings. Each exercise includes specific tasks for users to implement, emphasizing user input and output. The exercises are designed to enhance programming skills through practical applications.

Uploaded by

nobody5111227
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

C++ Lab Exercises

The document contains a series of C++ programming exercises focused on various concepts such as solving quadratic equations, temperature conversion, generating multiplication tables, reversing numbers, calculating harmonic series, printing patterns, and working with arrays and strings. Each exercise includes specific tasks for users to implement, emphasizing user input and output. The exercises are designed to enhance programming skills through practical applications.

Uploaded by

nobody5111227
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Exercises 1

1. Write a C++ program to find the roots of a quadratic equation ax^2 + bx + c = 0. Prompt

the user to enter the values of coefficients 'a', 'b', and 'c'. Calculate the discriminant (Δ)

using the formula Δ = b^2 - 4ac and then find the roots using the quadratic formula

2. Write a C++ program that prompts the user to input a temperature in Fahrenheit and then

converts it to Celsius using the general formula:

Celsius = (Fahrenheit - 32) * 5/9

Exercises 2

1. Write the program of multiplication table of n number by using for loop

1*1=1 2*1=2 3*1=3

1*2=2 2*2=4 3*2=6

1*3=3 2*3=6 3*3=9

2. Write the programs the user to enter a number, and then uses awhile loop to reverse the

digits of the number. Finally, it compares the original number with its reversed version to

determine if it is a palindrome or not.

3. Write the c++ program it calculate the harmonic series of n numbers and sum of harmonic

series by using looping statement

1/1 +1/2 +1/3 +1/4+ 1/5 +……..n

4. Write a C++ program to print the following pattern:

**

***

****

***

**
*

Exercises 3

1. Write a C++ array program it input student [20], Name [20], and mark[20] after

Compilation it returns name and grade of student?


2. Write a C++ program to compare two strings entered by the user. Prompt the user to

input two strings, and then compare them to determine if they are equal or if one string is

greater than the other. Display an appropriate message based on the comparison result.

3. Write a C++ program to reverse a string entered by the user. Prompt the user to input a

string, and then reverse the order of its characters. Display the original and reversed

strings.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy