0% found this document useful (0 votes)
18 views4 pages

Practical No - 02

The document provides C++ programs demonstrating basic arithmetic operations: addition, subtraction, multiplication, division, and modulus. Each operation includes a code snippet that prompts the user for two numbers and outputs the result. The structure of each program is similar, utilizing standard input and output functions.

Uploaded by

priya.rajak
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)
18 views4 pages

Practical No - 02

The document provides C++ programs demonstrating basic arithmetic operations: addition, subtraction, multiplication, division, and modulus. Each operation includes a code snippet that prompts the user for two numbers and outputs the result. The structure of each program is similar, utilizing standard input and output functions.

Uploaded by

priya.rajak
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/ 4

Practical no:-02

Aim:-Write a program to demonstrate operation in c++.

INPUT:-

1]Addition.

#include<iostream>

using namespace std;

int main()

int a,b,c;

cout<<"enter a first number:";

cin>>a;

cout<<"enter a second number:";

cin>>b;

c=a+b;

cout<<c;

return 0;

OUTPUT:-

2]subtraction.

INPUT:-

#include<iostream>

using namespace std;

int main()

int a,b,c;

cout<<"enter a first number:";


cin>>a;

cout<<"enter a second number:";

cin>>b;

c=a-b;

cout<<c;

return 0;

OUTPUT:-

3]Multiplication.

INPUT:-

#include<iostream>

using namespace std;

int main()

int a,b,c;

cout<<"enter a first number:";

cin>>a;

cout<<"enter a second number:";

cin>>b;

c=a*b;

cout<<c;

return 0;

OUTPUT:-
4]division.

INPUT:-

#include<iostream>

using namespace std;

int main()

int a,b,c;

cout<<"enter a first number:";

cin>>a;

cout<<"enter a second number:";

cin>>b;

c=a/b;

cout<<c;

return 0;

OUTPUT:-

5]modulus.

INPUT:-

#include<iostream>

using namespace std;

int main()
{

int a,b,c;

cout<<"enter a first number:";

cin>>a;

cout<<"enter a second number:";

cin>>b;

c=a%b;

cout<<c;

return 0;

OUTPUT:-

You might also like