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

Turbo CPP Programming Questions Class8

The document contains a series of C++ programming exercises suitable for Class 8 students. Each exercise includes a specific task, such as calculating the sum of two numbers, finding the area and perimeter of a rectangle, determining if a number is even or odd, calculating the average of marks from five subjects, and displaying a multiplication table. Sample code snippets are provided for each task to illustrate the implementation.

Uploaded by

vedant12agrawal
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)
7 views2 pages

Turbo CPP Programming Questions Class8

The document contains a series of C++ programming exercises suitable for Class 8 students. Each exercise includes a specific task, such as calculating the sum of two numbers, finding the area and perimeter of a rectangle, determining if a number is even or odd, calculating the average of marks from five subjects, and displaying a multiplication table. Sample code snippets are provided for each task to illustrate the implementation.

Uploaded by

vedant12agrawal
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

Turbo C++ Programming Questions with Answers (Class 8)

1. Write a C++ program to input two numbers and display their sum.
#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int a, b, sum;
cout << "Enter two numbers: ";
cin >> a >> b;
sum = a + b;
cout << "Sum = " << sum;
getch();
}

2. Write a C++ program to calculate area and perimeter of a rectangle.


#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
float length, breadth, area, perimeter;
cout << "Enter length and breadth: ";
cin >> length >> breadth;
area = length * breadth;
perimeter = 2 * (length + breadth);
cout << "Area = " << area << endl;
cout << "Perimeter = " << perimeter;
getch();
}

3. Write a program to find whether a number is even or odd.


#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int num;
cout << "Enter a number: ";
cin >> num;
if(num % 2 == 0)
cout << "Even number";
else
cout << "Odd number";
getch();
}

4. Write a program to input marks of 5 subjects and calculate average.


#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
float m1, m2, m3, m4, m5, average;
cout << "Enter marks of 5 subjects: ";
cin >> m1 >> m2 >> m3 >> m4 >> m5;
average = (m1 + m2 + m3 + m4 + m5) / 5;
cout << "Average Marks = " << average;
getch();
}

5. Write a program to display multiplication table of a number.


#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
int n, i;
cout << "Enter a number: ";
cin >> n;
for(i = 1; i <= 10; i++)
{
cout << n << " x " << i << " = " << n * i << endl;
}
getch();
}

You might also like