Exercises from book "Fundamentals of Computer Programming with C#" Exercise 6: Loops
-
Write a program that prints on the console the numbers from 1 to N. The number N should be read from the standard input.
-
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.
-
Write a program that reads from the console a series of integers and prints the smallest and largest of them.
-
Write a program that prints all possible cards from a standard deck of cards, without jokers(there are 52 cards: 4 suits of 13 cards).
-
Write a program that reads from the console number N and print the sum of the first N members of the Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, …
-
Write a program that calculates N!/ K! for given N and K(1 < K < N).
-
Write a program that calculates N!*K!/ (N - K)! for given N and K (1 < K < N).
-
In combinatorics, the Catalan numbers are calculated by the following formula:
for n ≥ 0. Write a program that calculates the n-th Catalan number by given n. -
Write a program that for a given integers n and x, calculates the sum:
-
Write a program that reads from the console a positive integer number N(N < 20) and prints a matrix of numbers as on the figures below:
-
Write a program that calculates with how many zeroes the factorial of a given number ends.
Examples:
N = 10->N! = 3628800-> 2 N = 20->N! = 2432902008176640000-> 4
-
Write a program that converts a given number from decimal to binary notation(numeral system).
-
Write a program that converts a given number from binary to decimal notation.
-
Write a program that converts a given number from decimal to hexadecimal notation.
-
Write a program that converts a given number from hexadecimal to decimal notation.
-
Write a program that by a given integer N prints the numbers from 1 to N in random order.
-
Write a program that given two numbers finds their greatest common divisor(GCD) and their least common multiple(LCM).You may use the formula LCM(a, b) = | a * b | / GCD(a, b).
-
* Write a program that for a given number n, outputs a matrix in the form of a spiral: