Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

C++ practice programs.

Rating
-
Sold
-
Pages
72
Uploaded on
27-05-2024
Written in
2023/2024

this are the program notes in which there are all programs that we can practice.

Institution
Course

Content preview

Q1. write a program to perform operations on constant.
#include <iostream>
using namespace std;
int main()
{
double d;
d=10+28.05+ 'A'+ 017;
cout<<"d = "<<d;
return 0;
}


Q2. Write a program to print friend list.
#include <iostream>
using namespace std;
int main()
{
cout<<"sanika\n"<<"pavar\n"<<"xyz\n";
return 0;
}


Q3. programming example to print addition of two constant
numbers
#include <iostream>
using namespace std;
int main()

, {
int a=10;
int b=20;
int c;
c=a+b;
cout<<"addition of "<< a << " and "<< b <<" is "<< c;
return 0;




Q 4. Write a program to declare value for variable a and b
print its addition, subtraction multiplication and division
#include <iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"\n enter value for a= ";
cin>>a;
cout<<"\n enter value for b= ";
cin>>b;
c=a+b;
cout<<"\nadd = "<<c;
c=a-b;
cout<<"\nsub = "<<c;
c=a/b;

, cout<<"\ndiv = "<<c;
c=a%b;
cout<<"\nMod = "<<c;
c=a*b;
cout<<"\nmult = "<<c;
return 0;
}


Q5. Write a program to declare two-digit number to variable
n and print its reverse of n;
#include <iostream>
using namespace std;
int main()
{
int n,r;
cout<<"\n enter a number = ";
cin>>n;


r=(n%10)*10+(n/10);
cout<<"\n rev of "<< n <<" = "<< r;
return 0;
}


Q6. Write a program to print reverse of three digit
#include <iostream>

, using namespace std;
int main()
{
int n,r;
cout<<"enter a number= ";
cin>>n;


r=(n%10)*100+((n/10)%10)*10+(n/100);
cout<<"rev = "<<r;
return 0;
}


Q7. Write a program to enter product cost and calculate GST
and total.
#include <iostream>
using namespace std;
int main()
{
float pc,gst,gstper,total;
cout<<"enter product cost = ";
cin>>pc;
cout<<"enter gst percentaage = ";
cin>>gstper;


gst=pc*gstper/100;

Written for

Course

Document information

Uploaded on
May 27, 2024
Number of pages
72
Written in
2023/2024
Type
Class notes
Professor(s)
S.b. regude sir
Contains
All classes

Subjects

$10.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
dnyaneshwarshinde1503

Get to know the seller

Seller avatar
dnyaneshwarshinde1503 tulsi college
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions