Skip to content

Instantly share code, notes, and snippets.

using System;
//Write a program that reads the radius r of a circle and prints its
//perimeter and area formatted with 2 digits after the decimal point.
//Examples:
//r perimeter area
//2 12.57 12.57
//3.5 21.99 38.48
class CirclePerimeterAndArea
using System;
//A company has name, address, phone number, fax number, web site and manager.
//The manager has first name, last name, age and a phone number.
//Write a program that reads the information about a company
//and its manager and prints it back on the console.
class PrintCompanyInformation
{
static void Main()
{
using System;
//Write a program that gets two numbers from the console and prints the greater of them. Try to implement this without if statements. Examples:
//a b greater
//5 6 6
//10 5 10
class NumberComparer
{
static void Main()
using System;
//Write a program that reads 3 numbers: an integer a (0 ≤ a ≤ 500),
//a floating-point b and a floating-point c and prints them in 4 virtual columns on the console.
//Each column should have a width of 10 characters. The number a should be printed in hexadecimal,
//left aligned; then the number a should be printed in binary form, padded with zeroes,
//then the number b should be printed with 2 digits after the decimal point, right aligned;
//the number c should be printed with 3 digits after the decimal point, left aligned.
//Examples:
//a b c result
using System;
//Write a C# program to print on screen the result of adding, subtracting,
//multiplying and dividing two numbers typed by the user.
//The remainder of the division must be displayed, too.
//It might look like this:
//Enter a number: 12
//Enter another number: 3
//12 + 3 = 15
//12 - 3 = 9
using System;
//Write a program that finds the biggest of three numbers.
//Examples:
//a b c biggest
//5 2 2 5
//-2 -2 1 1
//-2 4 3 4
class BigestOf3Numbers
{
using System;
//Write a program that enters 3 real numbers and prints them
//sorted in descending order. Use nested if statements.
//Don’t use arrays and the built-in sorting functionality.
//Examples:
//a b c result
//5 1 2 5 2 1
//-2 -2 1 1 -2 -2
//-2 4 3 4 3 -2
using System;
//Write an if-statement that takes two doubleeger variables a and b
//and exchanges their values if the first one is greater than the second one. As a result prdouble the values a and b, separated by a space. Examples:
// b result
//5 2 2 5
//3 4 3 4
//5.5 4.5 4.5 5.5
class ExchangeIfGreater
{
using System;
//Write a program that applies bonus score to given score in the range
//[1…9] by the following rules:
//• If the score is between 1 and 3, the program multiplies it by 10.
//• If the score is between 4 and 6, the program multiplies it by 100.
//• If the score is between 7 and 9, the program multiplies it by 1000.
//• If the score is 0 or more than 9, the program prints “invalid score”.
//Examples:
//score result
//2 20
using System;
//Classical play cards use the following signs to designate the card face:
//2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K and A.
//Write a program that enters a string and prints “yes”
//if it is a valid card sign or “no” otherwise. Examples:
//character Valid card sign?
// 5 yes
// 1 no
// Q yes
// q no