تفاصيل العمل

Problem 1: Summation of Numbers in a Collection

Description: (Note → Use Do While to solve this problem)

Take the size of a collection of numbers and the numbers themselves

from the user. Calculate and print the summation of the numbers.

---------------------------------------------------------------------------------------------

Problem 2: Factorial of a Number

Description: (Note → Use For Loop to solve this problem)

Write a program to calculate the factorial of a given number.

Factorial (0) =1, Factorial (1) = 1

Rule Factorial (n) = n * n-1 * n-2 *……… 1

If n = 5 Factorial (5) = 5 * 4 * 3 * 2 * 1 = 120

---------------------------------------------------------------------------------------------

Problem 3: Max, Min, and Average of a Collection

Description: (Note → Use For Loop to solve this problem)

Take the size of a collection of numbers and the numbers themselves

and print the maximum, minimum, and average of the numbers.

---------------------------------------------------------------------------------------------

Problem 4: Check for Prime Number

Description: (Note → Use For Loop to solve this problem)

Take a number from the user and check if it is a prime number or not.

5 5 divisible by only 5 and 1 => prime

6 6 divisible by 1,2,3 ,6 => not prime

---------------------------------------------------------------------------------------------

Problem 5: Count Divisible and Non-Divisible Numbers

Description: (Note → Use Do While to solve this problem)

Take the size of a collection of numbers, the numbers themselves,

and a divisor from the user. Count and print how many numbers are

divisible by the divisor and how many are not. (Do not use arrays

or array List)

ملفات مرفقة

بطاقة العمل

اسم المستقل
عدد الإعجابات
0
عدد المشاهدات
1
تاريخ الإضافة
تاريخ الإنجاز
المهارات