Back to Cosmos

README

code/languages/dart/README.md

latest2.2 KB
Original Source

Task 1

Write dart code of a program that reads two numbers from the user, and prints their sum, product, and difference.

==========================================================

hint: Subtract the second number from the first one

==========================================================

Example01:

Input:
4
5

Output:
Sum = 9
Product = 20
Difference = -1

==========================================================

Example02:

Input:
30
2

Output:
Sum = 32
Product = 60
Difference = 28

==========================================================

Task 2

Write dart code of a program that reads two numbers from the user. Your program should then print "First is greater" if the first number is greater, "Second is greater" if the second number is greater, and "The numbers are equal" otherwise.

==========================================================

Example:

Input:
-4
-4

Output:
The numbers are equal

==========================================================

Example:

Input:
-40
-4

Output:
Second is greater

Task 3

Write dart code of a program that reads two numbers, subtracts the smaller number from the larger one, and prints the result.

hint(1): First check which number is greater

==========================================================

Example:

Input:
-40
-4

Output:
36

==========================================================

Example:

Input:
6
2

Output:
4

Task 4

Write dart code of a program that reads a number, and prints "The number is even" or "The number is odd", depending on whether the number is even or odd.

hint(1): use the modulus (%) operator

hint(2): You can consider the number to be an integer

==========================================================

Example:

Input:
5

Output:
The number is odd

==========================================================

Example:

Input:
-44

Output:
The number is even

Task 5

Write dart code of a program that prints your name 5 times using for loop

==========================================================

Example:

Output:
Ikram Hasan Ikram Hasan Ikram Hasan Ikram Hasan Ikram Hasan

==========================================================