Download 1) Write a program that asks user for an integer value. The program

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
1) Write a program that asks user for an
integer value. The program should
accept only the positive numbers. If
the user enters a negative number,
program should display a warning
and should ask for another positive
number till correct value will be
given by user.
2) Write a program that asks user for an
integer values. If the given value and
the value given in preceeding
iteration are both even, this pair
should be displayed. Numbers are
read till user gives 0. Example:
For 1,2,3,22,4,9,3,6,8,8,1,0 program
should display:
22,4
6,8
8,8
3) Write a program that, for integer
numbers given by user till he/she
enters 0, depending on the user's
choice:
* Calculates and displays the sum
and the average of integers given by
user
* Displays the largest and the
smaller value given by user
4) Write a program that asks user to give
real numbers till he/she gives 0.
Program should (after finishing
reading user numbers) print values of:
 Product of all values less then userspecified value G
 Product of all values greater then
user-specified value G
5) Write a program that ask user to give
integer numbers till he/she gives 0.
Program should (after finishing
reading user numbers) print values of:
 Sum of all values divisible by 7
 Product of all values divisible by 7
6) Write a program that asks user for a
integer value X. Program should
display how many subsequent
positive values should be added to
obtain the smallest value which is
greater than user specified value G.
Additional task:
1) Write a program that for a given X displays all values less then X, which are prime
numbers.
2) Write a program that calculates the value of factorial for user specified integer value
X. For example: 7!=1*2*3*4*5*6*7, remember that 0!=1, 1!=1