0% found this document useful (1 vote)
257 views

Assignment 4

The document outlines 41 tasks involving drawing flowcharts and writing pseudocode for programs that perform various mathematical calculations and operations. The tasks include programs to print sequences, find averages, maximums/minimums, factorials, Fibonacci numbers, prime numbers, and breaking down monetary amounts.

Uploaded by

nehal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
257 views

Assignment 4

The document outlines 41 tasks involving drawing flowcharts and writing pseudocode for programs that perform various mathematical calculations and operations. The tasks include programs to print sequences, find averages, maximums/minimums, factorials, Fibonacci numbers, prime numbers, and breaking down monetary amounts.

Uploaded by

nehal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Task 1:

Draw the flowchart of a program that prints the first ten positive integers.
Task 2:
Draw the flowchart of a program that prints the first ten even positive integers.
Task 3:
Draw the flowchart of a program that reads five numbers as input from the user, and prints
whether the numbers are odd or even.
Task 4:
Draw the flowchart of a program that reads five numbers from the user, and prints their average.
Task 5:
Repeat task 3 for twenty numbers.
Task 6:
Repeat task 4 for twenty numbers.
Task 7:
Repeat task 1 for the first hundred positive integers.
Task 8:
Repeat task 2 for the first hundred even positive integers.
Task 9:
Write 3 separate flowcharts that print the following 3 sequences of values in loops:
a) 24, 18, 12, 6, 0
b) -10, -5, 0, 5, 10, 15
c) 18, 27, 36, 45, 54
d)

Task 10:
Draw the flowchart for the following:
1) Ask the user to enter the name of his favorite car.
2) Ask the user to enter a Number
3) Display the name of the user’s favorite car, number of time specified in the second step.
Example: If the user enters “Toyota” and 20, your program should print the name Toyota twenty
times.

Task 11:
Draw the flowchart to display all the odd numbers between 10 and 50.

Task 12:
Draw the flowchart and write the pseudo-code for the following:
Take seven numbers input from the user and find the maximum and the average.

Task 13:
Draw the flowchart for the following:
Take five numbers input from the user and find the minimum and the average of the even
numbers entered by the user. [If the user enters odd numbers ignore them]

Task 14:
Write a flowchart that reads the value of n and calculates the value of y if the expression of y is
as follows:
y 3  13  2 3  33  4 3  53  6 3  ............ n 3

Task 15:
Write a flowchart that will calculate the value of y if the expression of y is as follows (n is the
input):
y  12  2 2  32  4 2  52 ............  n 2

Task 16:
Write a flowchart that will calculate the value of y if the expression of y is as follows (n is the
input):
1 2 3 4 n
y      ............. 
1 3 5 7 (2n  1)

Task 17:
Draw the flowchart of a program which adds all numbers that are multiples of both 7 and 9 up to
600.

Task 18:
Draw the flowchart of a program which adds all numbers that are multiples of either 7 or 9 up to
600. Ensure that numbers like 63 are added only once in the sum.

Task 19:
Draw the flowchart of a program which adds all numbers that are multiples of either 7 or 9 but
not both, up to 600.

Task 20:
Draw the flowchart and write the pseudo-code for the following:
 Ask the user to enter a Number
 Display the summation of multiples of 7 up to that number.
Example: If the user enters 50, your program should print 196. (because: 7 + 14 + 21 + 28 + 35 +
42 + 49 = 196).

Task 21:
Write a complete pseudo-code and the flowchart of a program, which adds all the multiples of 7
and 9 up to 300.

Task 22:
Draw the flowchart of a program that asks the user to enter ten numbers then display ONLY the
total and the average of the odd numbers among those ten numbers.
[Hint: Example Input: 1 2 3 4 5 6 7 8 9 10 and Example Output: Total is 25 and Average is 5
(i.e., Total is 25 = (1+3+5+7+9) and Average is 25/5 = 5)]

Task 23:
Solve Task 22 for even numbers instead of odd numbers.

Task 24:
Solve Task 22 for numbers that are multiples of 4, instead of odd numbers.

Task 25:
a) Do problem 12 to find the minimum and the average of those seven numbers.
b) Find the maximum and the average of the odd numbers entered by the user. [If the user enters
even numbers ignore them]

Task 26:
Write a flowchart of a program that reads a number N, and prints out the sum of all odd numbers
from 1 to N inclusive. For instance, if the input is 6, the output for the program should be 9.

Task 27:
Write a flowchart that calculates and prints the sum of the even integers from 10 to 60.

Task 28:
Write a flowchart that reads a list of numbers, and prints out the product of all the numbers read.
You may assume that the user first inputs the total number of numbers. For example, if the first
input is 4, then the program has to read in four numbers from the user, and print out the product
of these four numbers. Please do not assume anything other than what you have been directly
told, and what you know to be mathematical facts.

Task 29:
Write a flowchart that calculates and prints the product of the odd integers from 3 to 13.

Task 30:
Write a flowchart that will read 20 numbers from the user, and then print the first number, the
sum of the first 2 numbers, first 3 numbers, and so on up to the sum of 20 numbers.

Task 31:
Write a flowchart program that reads marks of ten courses and prints the maximum, minimum
and average of those ten marks.

Task 32:
Write a flowchart of a program, which adds all the multiples of 7 and 9 up to 300.

Task 33:
In mathematics, the Fibonacci numbers form a sequence defined by the following recurrence
relation:

That is, after two starting values, each number is the sum of the two preceding numbers. The first
Fibonacci numbers, also denoted as Fn, for n = 0, 1, … , are:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,

Draw the flowchart of a program, which prints all Fibonacci numbers that are less than 1600.

Task 34:
Draw the flowchart of a program that does the following:
1) Ask the user to enter a Number
2) Display the summation of multiples of 4 up to that number.
Example: If the user enters 30, your program should print 112. (because: 4 + 8 + 12 + 16 + 20 +
24 + 28 = 112)

Task 35:
A Slytherin number is defined as follows: the first Slytherin number is 1, and the second
Slytherin number is 2. Every other Slytherin number is the product of the last two Slytherin
numbers. That being said, your task is to write a flowchart that will generate and print the first
1000 Slytherin numbers. Have fun!
Task 36:
Write a flowchart that finds CGPA given credits and grade of n courses where n is the user input.

Task 37:
An integer number is said to be a perfect number if its factors, including 1 but not the number
itself, sum to the number. For example, 6 is a perfect number because 6 = 1 + 2 + 3. Write a
complete flowchart of a program, which finds and prints all perfect numbers that are less than
1600.

Task 38:
Draw the flowchart of a program that takes a number as input and displays "prime" if the input is
a prime number and "not prime" if the input is not a prime number.

Task 39:
Write flowchart of a program that finds and displays all the prime numbers less than 1000.

Task 40:
Write a flowchart of a program that, given an “amount” of money, shows it split into 500, 100,
50, 20, 10, 5, 2 and 1 taka bills or coins. The output would be:
Say for 1234 it says:
500 Taka: 2 note(s)
100 Taka: 2 note(s)
50 Taka: 0 note(s)
20 Taka: 1 note(s)
10 Taka: 1 note(s)
5 Taka: 0 note(s)
2 Taka: 2 note(s)
1 Taka: 0 note(s)

Task 41:
Write a flowchart that reads an integer and extracts and displays each digit of the integer in
English. So, if the user types in 451, the program will display four five one.

You might also like