The greatest common divisor, also known as GCD, is the greatest number that will, without a remainder, fully divide a pair of integers.
Now, I want you to make a program that will accept two integers and with the use of loops, print out their GCD. Make good use of conditional statements as well.
Off you go!
Input
A line containing two integers separated by a space.
6·9Output
A line containing an integer.
3As I've said before, there are three types of numbers: the positive, the zero, and the negative ones. Today, we shall pay attention only to the negative ones now. Make a loop that will accept random decimal/float numbers. When the user inputs 0, the loop will terminate and then output the sum of all negative numbers inputted in 3 decimal places.
Let's code this.
Input
Multiple lines containing a decimal.
2.4434
-1.3433
-2.444
6.432
0Output
A line containing a decimal with three decimal places.
-3.787Make a program that will accept an integer and loop from 1 to that integer. Then, print all numbers from that range that are greater than 3.
Let's go!
Input
A line containing an integer.
8Output
Multiple lines containing an integer.
4
5
6
7
8How many zeroes are there after the last non-zero digit of a million? a trillion? To easily identify that, let us make a program to count and print the number of zeroes after the last non-zero digit of a number. For example, in 20400, there are 2 zeroes after the last non-zero digit of the number, 4.
Are you up for this challenge?
Input
A line containing an integer.
20400Output
A line containing an integer.
2I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.
How about that?
Input
A line containing two integers separated by a space.
3·10
Output
Multiple lines containing an integer.
10
8
6
4
Remember the game of FizzBuzz from the last time? Well, I thought of some changes in the game, and also with the help of loops as well. Firstly, you'll be asking for a random integer and then loop from 1 until that integer. Then, implement these conditions in the game:
print "Fizz" if the number is divisible by 3
print "Buzz" if the number is divisible by 5
print "FizzBuzz" if the number is divisible by both 3 and 5
print the number itself if none of the above conditions are met
Input
A line containing an integer.
15
Output
Multiple lines containing a string or an integer.
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
Create a class Person with attributes string Name, string Address and int age and define getter setter method using Auto Implementation Property
• Create a class PersonImplementation and implement the below given methods:
1. GetName(IList<Person> person) display the name and address of all the persons in the List
2. Average(List<Player> players) to calculate the average age of all the persons.
3. Max(IList<Player> players) to find the maximum age of the person.
First and last digit
Input
5
30
Elements of anti diagonal
Input
3
123
456
789
Inter Leave Strings
Input
a,b,c
p,q,r