Place all codes under the method main.
1. Input 5 numbers and satisfy the ff:
a) sum of all input numbers
b) count of odd and even numbers except zero
c) count of positive, negative, and zeroes
d) count of divisible by 5
2. Generate 20 random numbers from 50-100 only and determine the ff:
a) the number of times 100 occurs
b) what are the lowest and highest generated numbers
3. Convert #1 to methods:
methods: main - calls method series
series - declares the array and its size
- calls the different methods below
input - input 5 numbers
output - display the array elements
sum - compute and display the sum
oddeven - count the odd and even numbers, display the results
posnegzero - count the positive, negative, and zeroes, display the results
div5 - count the numbers that are divisible by 5, display the result
4. Convert #2 to methods:
methods: main - calls method randomnumbers
randomnumbers - declares the array and its size
- call the methods below:
fill - populate the array with random numbers
display - display the array elements
t100 - counts the number of times 100 occurs, display the result
highlow - determines the lowest and highest numbers (the 1st element of the array is regarded as the lowest and the highest value from the start), display the results
Walang komento:
Mag-post ng isang Komento