Anda di halaman 1dari 3

La Salette of Roxas College Inc.

Magsaysay St. Vira, Roxas, Isabela

Activity I. Profit Calculator

Write a C++ program to input cost price and selling price of a product and check profit
or loss. Also calculate total profit or loss using if else. How to calculate profit or loss on
any product using if else in C programming. Program to calculate profit and loss of any
product in C++.

Example
Input
Input cost price: 1000
Input selling price: 1500

Output

Profit: 500

Activity II. If else Condition

Write a C++ program to find maximum between two numbers using if else. C++
program to input two numbers from user and find maximum between two numbers
using if else. How to find maximum or minimum between two numbers using if else in
C++ programming.

Example
Input
Input num1: 10
Input num2: 20

Output

Maximum = 20

Activity III. Using WHILE LOOP

Write a C++ program to print all natural numbers from 1 to n using loop. C++ program to
print first n natural numbers using loop. How to print natural numbers in a given range
using loop. Logic to print natural numbers using for loop in C++ program.

Example

Input

Input upper limit: 10

Output

Natural numbers from 1 to 10: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10


Activity IV.

Write a C++ program to print all natural numbers in reverse from n to 1 using for loop. How
to print natural numbers in reverse order in C++ programming. Logic to print natural
numbers in reverse for a given range in C++ program.

Example

Input

Input N: 10

Output

Natural numbers from 10-1 in reverse:


10, 9, 8, 7, 6, 5, 4, 3, 2, 1

Activity 5

Write a C++ program to input two numbers and perform all arithmetic operations. How
to perform all arithmetic operation between two numbers in C++ programming. C++
program to find sum, difference, product, quotient and modulus of two given numbers.

Example
Input
First number: 10
Second number: 5

Output

Sum = 15
Difference = 5
Product = 50
Quotient = 2
Modulus = 0
Birthday Guessing Program

Background You can find out the date of the month when your friend was born by asking five questions.
Each question asks whether the day is in one of the five sets of numbers.

The birthday is the sum of the first numbers in the sets where the day appears. For example, if the
birthday is 19, it appears in Set1, Set2, and Set5. The first numbers in these three sets are 1, 2, and 16.
Their sum is 19.

Anda mungkin juga menyukai