Saturday, October 20, 2018

Find the Smallest Number from 10 Numbers

Question

Draw flowchart, write pseudocode and Pascal program for the problem of finding the smallest number of 10 numbers.


Answer

Flowchart


flowchart to find smallest number
 
Pseudocode

Start
input number N
Min=N
Count=1
While Count <10
        Input number N
        if  N < Min
              Min=N
        endif
        Count=Count + 1
end while
print Min
end

Pascal Program

 
Program fimdsmallest;
var
  N:Integer;
  Count:integer;
  Min:integer;
begin
  write('Enter a Number ?');
  readln(N);
  Count:=1;
  Min:=N;
  while Count < 10 do
  begin
    write('Enter a Number ?');
    readln(N);
    if N < Min then
       Min:=N;
    Count:=Count+1;
  end;
  write('Minimum Number is :') ;
  writeln(Min);
  readln;
end.

Output Screen of the above Pascal program


FindSmallestNum



1 comment: