Sale!

1. Simple operations and calculations. Primitive data types

$30.00

Category:

Description

5/5 - (3 votes)

1. Simple operations and calculations. Primitive data
types.
1.01. Write a program which initializes 2 variables and then
swaps their values.
1.02. Write a program that calculates the length of the
medians of a triangle, which is formed by the medians of a
given triangle with sides a, b, c. Assume that such triangle
with sides a, b, c exist.
1.03. Write a program which asks the user for his age and
then prints the number of seconds, days, weeks, months he has
lived on the Earth.
1.04. Write a program which asks the user for the lengths of
sides of a triangle and prints the area of the triangle.
1.05. Write a program which asks the user for three numbers
a, d and n and prints the sum of the first n numbers of
arithmetic progression with starting number a and difference
d.
1.06. Yana decides to make a party and goes to the alcohol
market to buy beer, wine, brandy and whiskey. On the console
she inputs the price of the whiskey (lv./liter), and the
quantities of the products, which she has to buy (liters).
Write a program that calculates how much money she needs to
pay for the bill, knowing that:
– the price of the brandy is half-lower than this of the
whiskey;
– the price of the wine is with 40% cheaper than this of
the brandy;
– the price of the beer is with 80% cheaper than this of
the brandy;
Print a single number on the console: the money that Yana
needs to pay for the bill, formatted to the second digit
after the floating point.