Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 2.44 KB

basics.md

File metadata and controls

53 lines (37 loc) · 2.44 KB

Conditional statements and loops

  1. Write a program that reads from the console three numbers of type int and prints their sum.

  2. Write a program that reads five numbers from the console and prints the greatest of them.

  3. Write a program that reads from the console the radius "r" of a circle and prints its perimeter and area.

  4. Write a program that reads from the console two integer numbers (int) and prints how many numbers between them exist that are divisible with 5. such that the remainder of their division by 5 is 0.

Example: in the range (14, 25) there are 3 such numbers: 15, 20 and 25.

  1. Write a program that reads two numbers from the console and prints the greater of them. Solve the problem without using conditional statements and with conditional statements.

  2. Write a program that reads five integer numbers and prints their sum. If an invalid number is entered the program should prompt the user to enter another number(only once)

  3. Write a program that prints on the console the numbers from 1 to N. The number N should be read from the standard input.

  4. Write a program that prints on the console the numbers from 1 to N, which are not divisible by 3 and 7 simultaneously. The number N should be read from the standard input.

  5. Write a program that reads from the console a series of 5 integers and prints the smallest and largest of them.

  6. Write program that outputs a triangle made of stars with variable size, depending on an input parameter. Look at the examples to get an idea. The input comes as a string number, which needs to be parsed to a number. The output is a series of lines printed on the console, forming a triangle of variable size.

Input 2:   
Output:    
*   
**
*

11* . Write a program that converts a given number from decimal to binary notation (numeral system).

12*. Write a program that by a given integer N prints the numbers from 1 to N in random order

13*. A program which iterates the integers from 1 to 50 For multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".

Output : 
fizzbuzz
1
2
fizz
4 
buzz

14 A given company has name, address, phone number, fax number, web site and manager. The manager has name, surname and phone number. Write a program that reads information about the company and its manager and then prints it on the console.