0% found this document useful (0 votes)
11 views6 pages

Basic Programs 2

The document outlines several programming tasks involving arithmetic operations, calculating the perimeter and area of a rectangular cricket stadium, computing loan interest and repayments, and determining profit for a newspaper agency. Each task includes input and output formats with example cases. The focus is on writing programs to perform specific calculations based on provided inputs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views6 pages

Basic Programs 2

The document outlines several programming tasks involving arithmetic operations, calculating the perimeter and area of a rectangular cricket stadium, computing loan interest and repayments, and determining profit for a newspaper agency. Each task includes input and output formats with example cases. The focus is on writing programs to perform specific calculations based on provided inputs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Artihmetic operator

Write a program to perform arithmetic operations such as addition, subtraction,


multiplication, modulo division and division.
INPUT & OUTPUT FORMAT:
Input consists of two integers
Output consist of integers

Case 1
Input (stdin)
5
2

Output (stdout)
7
3
10
1
2

Case 2
Input (stdin)
9
3

Output (stdout)
12
6
27
0
3

Cricket Stadium
There was a large ground in center of the city which is rectangular in shape. The
Corporation decides to build a Cricket stadium in the area for school and college
students, But the area was used as a car parking zone. In order to protect the
land from using as an unauthorized parking zone , the corporation wanted to
protect the stadium by building a fence. In order to help the workers to build a
fence, they planned to place a thick rope around the ground. They wanted to buy
only the exact length of the rope that is needed. They also wanted to cover the
entire ground with a carpet during rainy season. They wanted to buy only the
exact quantity of carpet that is needed. They requested your help. Can you
please help them by writing a program to find the exact length of the rope and the
exact quantity of carpet that is required?
Input format:
Input consists of 2 integers. The first integer corresponds to the length of the
ground and the second integer corresponds to the breadth of the ground. Output
Format:
Output Consists of two integers. The first integer corresponds to the perimeter.
The second integer corresponds to the quantity of carpet required.

Case 1
Input (stdin)
50
20
Output (stdout)
140
1000

Case 2
Input (stdin)
70
40
Output (stdout)
220
2800
Dept Repay
Alice wanted to start a business and she was looking for a venture capitalist.
Through her friend Bob, she met the owner of a construction company who is
interested to invest in an emerging business. Looking at the business proposal,
the owner was very much impressed with Alice's work. So he decided to invest in
Alice's business and hence gave a green signal to go ahead with the project.
Alice bought Rs.X for a period of Y years from the owner at R% interest per
annum. Find the rate of interest and the total amount to be given by Alice to the
owner. The owner impressed by proper repayment of the financed amount
decides to give a special offer of 2% discount on the total interest at the end of
the settlement. Find the amount given back by Alice and also find the total
amount. (Note: All rupee values should be in two decimal points).
INPUT FORMAT:
Input consists of 3 integers. The first integer corresponds to the principal
amount borrowed by Alice. The second integer corresponds to the rate of
interest The third integer corresponds to the number of years.
OUTPUT FORMAT:
The output consists of 4 floating point values. The first value corresponds to the
interest. The second corresponds to the amount. The third value corresponds to
the discount. The last value corresponds to the final settlement. All floating point
values are to be rounded off to two decimal places

Case 1
Input (stdin)
100
1
10
Output (stdout)
10.00
110.00
0.20
109.80
Case 2
Input (stdin)
10000
10
5

Output (stdout)
5000.00
15000.00
100.00
14900.00
The newspaper Agency
Each Sunday, a newspaper agency sells w copies of a special edition newspaper
for Rs.x per copy. The cost to the agency of each newspaper is Rs.y. The
agency pays a fixed cost for storage, delivery and so on of Rs.100 per Sunday.
The newspaper agency wants to calculate the profit which it obtains only on
Sundays. Can you please help them out by writing a program to compute the
profit if w, x, and y are given.
INPUT FORMAT:
Input consists of 3 integers: w, x, and y. w is the number of copies sold, x is the
cost per copy and y is the cost the agency spends per copy.
OUTPUT FORMAT:
The output consists of a single integer which corresponds to the profit obtained
by the newspaper agency.

Case 1
Input (stdin)
1000
2
1

Output (stdout)
900

Case 2
Input (stdin)
900
5
3
Output (stdout)
1700

You might also like