S.
NO TOPIC DATE
1. Write a program to display “Hello World” 18-09-2025
.
2. Write a program to add two numbers. 18-09-2025
3. Write a program to find the sum of all digits of a 18-09-2025
4-digit integer Number.
4. Write a program to calculate area of 18-09-2025
circle,square,and volume of cuboid .
5. Write a program that simulates an ATM 18-09-2025
withdrawal. The user enters their account
balance and withdrawal amount.
6. Write a program to read the temperature in 18-09-2025
Celsius and display its category.
7.. Write a program to simulate simple login 18-09-2025
system.
8. Write a program to calculate the discount on a 18-09-2025
shopping mall.
9. Write a program to calculate an employee’s 18-09-2025
weekly salary.
10. Write a program to calculate the electricity bill 18-09-2025
based on units consumed.
11. Write a program to design a simple calculator. 18-09-2025
12. Write a program that accepts a color input 18-09-2025
representing a traffic light (Red, Yellow,Green).
13. Write a program to input the marks of a student 18-09-2025
( in %) and assign grades.
14. Write a program to check whether a person is 18-09-2025
eligible for voting or not.
15. Write a program to check whether a year is 18-09-2025
leap or not
S. NO TOPIC DATE
1. Write a program to display “Hello World” 18-09-2025
.
.
1)Write a program to display “Hello World” .
#include<iostream>
using namespace std;
int main()
{
cout<<"Hello World"<<endl;
cout<<" © NAME: MANAS PATIDAR"<<endl;
cout<<"ENROLLMENT NO. : BTIR25O1029";
return 0;
}
Output:
2)Write a program to add two numbers.
#include<iostream>
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter 1st Number:";
cin>>a;
cout<<"Enter 2nd Number:";
cin>>b;
c=a+b;
cout<<"The sum of "<<a<<" and "<<b<<" is "<< c;
return 0 ;
}
Output
3) Write a program to find the sum of all digits of a 4-digit
integer Number.
#include<iostream>
using namespace std;
int main()
{
int n,sum=0,r;
cout<<"Enter the 4-digit Number:";
cin>>n;
r=n%10;
sum=sum+r;
n=n/10;
r=n%10;
sum=sum+r;
n=n/10;
r=n%10;
sum=sum+r;
n=n/10;
sum=sum+n;
cout<<"The Sum of all Digits is "<<sum;
return 0;
Output :
4) Write a program to calculate area of circle,square,and
volume of cuboid .
…………………………..……….AREA OF CIRCLE………………………………..
#include<iostream>
using namespace std;
int main()
{
const float PI=3.14;
float radius,area;
cout<<"Enter the Radius of Circle:";
cin>>radius;
area=PI*(radius*radius);
cout<<"The area of Circle is "<<area<<" Meter Square";
return 0;
}
Output:
…………………………………..…AREA OF SQUARE……………………………..
#include<iostream>
using namespace std;
int main()
{
float side,area;
cout<<"Enter the Side of Square:";
cin>>side;
area=(side*side);
cout<<"The area of Square is "<<area<< " Meter Square";
return 0;
Output:
…………………………………….VOLUME OF CUBOID…………………………………..
#include<iostream>
using namespace std;
int main()
{
float height, length, breadth,volume;
cout<<"Length of Cuboid:";
cin>>length;
cout<<"Breadth of Cuboid:";
cin>>breadth;
cout<<"Height of Cuboid:";
cin>>height;
volume=(length*breadth*height);
cout<<"The Volume of Cuboid is "<<volume<<" cubic meter";
return 0;
Output:
5) Write a program that simulates an ATM withdrawal. The user
enters their account balance and withdrawal amount.
#include<iostream>
using namespace std;
int main()
{
int deposit,withdraw,remain;
cout<<"Enter Account Balance:";
cin>>deposit;
cout<<"Enter Withdraw Amount:";
cin>>withdraw;
remain=deposit - withdraw;
if(withdraw<=deposit && withdraw%100==0)
{
cout<<"CONGRATUALATIONS, YOUR WITHDRAW is SUCCESSFULL"<<endl;
cout<<" YOUR CURRENT NEW BALANCE IS "<<remain <<" RUPEES";
}
else if(withdraw>deposit)
{
cout<<"INSUFFICIENT BALANCE IN YOUR ACCOUNT...."<<endl;
}
else
{
cout<<" INVALID WITHDRAWAL AMOUNT....TRY AGAIN";
}
return 0;
}
Output :
6) Write a program to read the temperature in Celsius and
display its category.
#include<iostream>
using namespace std;
int main()
{
float temperature;
cout<< "Enter the Temperature (in Celsius):";
cin>>temperature;
if(temperature<0)
{
cout<<"It's a FREEZING WEATHER";
}
else if(temperature<20 && temperature>0)
{
cout<<"It's COLD WEATHER";
}
else{
cout<<"It's WARM/HOT WEATHER";
}
return 0;
}
Output:
7) Write a program to calculate the discount on a shopping
mall.
#include<iostream>
using namespace std;
int main()
{
float purchase,discount;
cout<<"Enter Purchasing Price:";
cin>>purchase;
if(purchase>=5000)
{
discount = (purchase *20)/100;
purchase =purchase - discount;
cout<<"NEW PAYABLE AMOUNT (AFTER DISCOUNT) : "<<purchase<<endl;;
else if(purchase>=2000 && purchase<4999)
{
discount = (purchase *10)/100;
purchase =purchase - discount;
cout<<"NEW PAYABLE AMOUNT (AFTER DISCOUNT) : "<<purchase<<endl;
}
else if(purchase<2000)
{
cout<<"PAYABLE AMOUNT : "<<purchase<<endl;
}
cout<<".................................THANK-YOU FOR
SHOPPING......................................."<<endl<<endl;
return 0;
}
Output:
8)Write a program to simulate simple login system.
#include<iostream>
using namespace std;
int main()
{
string name;
int lock;
cout<<".................SET YOUR
PASSWORD........................"<<endl<<endl;
cout<<"Enter Your Username :";
cin>>name;
cout<<"Set Your Password (0-9):";
cin>>lock;
const string username = name;
const int password = lock;
cout<<".....CONGRATULATIONS, YOUR PASSWORD SET
SUCCESSFULLY......."<<endl<<endl;
cout<<"......................Let's Login
It................................"<<endl;
cout<<"Enter Your Username :";
cin>>name;
cout<<"Set Your Password (0-9) :";
cin>>lock;
if(name==username && lock==password)
{
cout<<"............LOGIN SUCCESSFULL.............\n";
}
else
{
cout<<"You Entered INCORRECT Username or Password....TRY
AGAIN.....\n";
}
return 0;
}
Output:
9) Write a program to calculate an employee’s weekly salary
#include<iostream>
using namespace std;
int main()
{
int hours,rate,salary,extra_hours;
cout<<"Enter Your Working Hours :";
cin>>hours;
cout<<"Enter Your Hourly Rate :";
cin>>rate;
extra_hours = hours-40;
if(hours<=40)
{
salary = (hours * rate);
cout<<"TOTAL SALARY :"<<salary<<endl;
}
else if(hours>40){
salary = (40 * rate) + (extra_hours * 1.5 * rate);
cout<<"TOTAL SALARY :"<<salary<<endl;
}
return 0;
}
Output:
10) Write
a program to calculate the electricity bill based on
units consumed
#include<iostream>
using namespace std;
int main()
{
int units;
cout<<"Enter Electricity Units :";
cin>>units;
if(units<=100)
{
cout<<"Your Electricity Bill is "<<(units*5)<<" Rupees "<<endl;
}
else if(units>=101 && units<=300)
{
cout<<"Your Electricity Bill is "<<(units*8)<<" Rupees "<<endl;
}
else if(units>300)
{
cout<<"Your Electricity Bill is "<<(units*10)<<" Rupees "<<endl;
}
return 0;
Output:
11) Write a program to design a simple calculator
#include<iostream>
using namespace std;
int main()
{
float a,b;
char o;
cout<<"Enter the 1st Number:";
cin>>a;
cout<<"Enter the 2nd Number:";
cin>>b;
cout<<"Select Operator (+,-,*,/):";
cin>>o;
if(o=='+')
{
cout<<"The Sum of "<<a<<" and "<<b<<" is "<<a+b<<endl;
}
else if(o=='-')
{
cout<<"The Difference of "<<a<<" and "<<b<<" is "<<a-b<<endl;
}
else if(o=='*')
{
cout<<"The Product of "<<a<<" and "<<b<<" is "<<a*b<<endl;
}
else if(o=='/' && b!=0)
{
cout<<"The Divison of "<<a<<" and "<<b<<" is "<<a/b<<endl;
}
else{
cout<<"Invalid Operator....Try Again"<<endl;
}
return 0;
Output:
12) Write a program that accepts a color input representing a
traffic light (Red, Yellow,Green).
#include<iostream>
using namespace std;
int main()
{
string c;
cout<<"ENTER THE COLOR:";
cin>>c;
if(c == "Red"|| c == "red"|| c== "RED")
{
cout<<"STOP";
}
else if(c == "Yellow"|| c == "yellow" || c=="YELLOW")
{
cout<<"READY TO MOVE";
}
else if(c == "Green"|| c == "green" || c=="GREEN")
{
cout<<"GO";
}
else
{
cout<<"INVALID TRAFFIC COLOR...TRY AGAIN"<<endl<<endl;
}
return 0;
}
Output:
13) Write
a program to input the marks of a student ( in %)
and assign grades.
#include<iostream>
using namespace std;
int main()
{
int marks;
cout<<"Enter Your Marks (in %):";
cin>>marks;
if(marks>=90)
{
cout<<"GRADE A";
}
else if(marks>=75 && marks<=89)
{
cout<<"GRADE B";
}
else if(marks>=50 && marks<=74)
{
cout<<"GRADE C";
}
else{
cout<<"FAIL";
}
return 0;
}
Output:
14) Writea program to check whether a person is eligible for voting
or not.
#include<iostream>
using namespace std;
int main()
{
int age;
cout<<"Enter Your Age:";
cin>>age;
if(age>=18)
{
cout<<"You are ELIGIBLE to Vote";
}
else
{
cout<<"You are NOT ELIGIBLE to Vote";
}
return 0;
}
Output:
15) Write a program to check whether a year is leap or not
#include<iostream>
using namespace std;
int main()
{
int year;
cout<<"Enter the Year:";
cin>>year;
if(year%4==0 || year%400==0 && year%100!=0)
{
cout<<"It's a LEAP Year";
}
else
{
cout<<"It's NOT a Leap Year";
}
return 0;
}
Output: