Assignment: Course: ICP (CSC141) Class: EPE-2 Max. Marks: 25 Copied and Late Assignments Will Be Marked As Zero
Assignment: Course: ICP (CSC141) Class: EPE-2 Max. Marks: 25 Copied and Late Assignments Will Be Marked As Zero
Max. Marks: 25
Q1. Write a program that would generate the first 10 elements of each series. Use a separate
‘while’ loop to generate each series.
a) 1, 2, 3, 4, …
b) 1, 3, 5, 7, …
c) 1, 5, 10, 16, 23, 31, …
d) 6, 12, 18, 24, …
e) 100, 90, 80, …
Q2. Write a program that gives the average of any number of values entered by the user. The
program should terminate when the input is –1. Try to limit your program to five variables.
Q3. Write a program that finds the sum of positive numbers less than and equal to 30. The
answer should be 465.
Q4. Write a program that prints all odd positive integers less than 100, skipping those that are
exactly divisible by 7. Do this program using one variable only.
Q5. Write a program that finds the product of positive odd numbers less than 20.
Q6. Write a program that would generate the first 10 elements of each series. Use a separate ‘do’
loop to generate each series.
a) 2, 4, 6, 8, …
b) 1, 4, 9, 16, 25, 36, …
c) 1, 3, 9, 27, …
d) 50, 60, 70, …
e) 1000, 500, 250, 125, …