NAME: SUMEET KANHIYA
ROLL NO:
SECTION: A3
SUBJECT: PROGRAMMING FUNDAMENTALS
SUBMITTED TO: ENGR. SOFIA HAJANO
1. For each of the following statement write down the flow chart symbol you will use.
A B C D E F
Statement Flow chart symbol
Terminate the process A
Set the variable a = 5 B
Calculate the square of a number B
Getting name of the user D
Initiate the process A
Continue a flow chart on the next page F
Displaying the marks of student D
Executing another process C
Prompting the user D
Continue a flow chart on the same page E
Problem Statement 1:
Write a computer program that accepts the base and height of a right angle triangle from the user and
displays the area of the triangle.
INPUT PROCESSING OUTPUT
base of a right angle PROCESSING ITEM: area of the triangle
triangle A= ½ x base x height
height of a right angle ALGORITHM:
triangle Step 1: start
Step 2: input the base of the triangle from user
Step 3: input the height of the triangle from user
Step 4: Calculate the area of the triangle using the
formula: Area=1/2×base×height
Step 5: Display the calculated area.
Step 6: End
Flow chart
START
Input the base of the triangle
Input the height of the triangle
Area=1/2×base×height
PRINT AREA
END
Problem Statement 2
Write a program that asks the user to enter a four digit integer number and displays the average of all
the four digits of a number.
Sample output:
9+4+2+ 5
Input: Output:
4
number = 9425 = 5
average =
INPUT PROCESSING OUTPUT
PROCESSING ITEM: average of the four
Four-digit number average = (digit1 + digit2 + digit3 + digit4) / 4) digits
ALGORITHM:
Step 1: start
Step 2: input a four-digit integer from user
Step 3: Extract each digit from the input number:
Digit1 = First digit, Digit2 = Second digit, Digit3 =
Third digit, Digit4 = Fourth digit
Step 4: Calculate the total sum of the four digits.
Step 5: the average dividing by 4.
Step 6: Print the average
Step 7: End
2. Write down the problem statement for the following flow
chart.
Problem statement:
Write a program that takes a four-digit number as input from user and
print its first digit.