Question 1
A School has 1000 students. The following pseudocode segment prints the admission numbers of students who attended the school everyday (i.e 210 days) in a particular year.
N=0 While N <1000 get AdmissionNumber get NumberOfDays if NumberOfDays=210 then print AdmissionNumber end if N=N+1 End while
Draw a flowchart to represent the above pseudocode. (Use the same variable names as given in the pseudocode in your flowchart.)
Note for extra knowledge
Pseudocode and flowcharts are designing tool/technic for algorithm. Once we correctly did it, it would be very easy to write in any programming languages.
Pascal Program is given below.
progrma printadno; var N:integer; AdmissionNumber:integer; NumberOfDays:integer; begin N:=0; while N < 1000 do begin writeln('Enter Addmission Number ?'); readln(AdmissionNumber); writeln('Enter Number of days?'); readln(NumberOfDays); if NumberOfDays=210 then Writeln(AdmissionNumber); N:=N+1; end; end.
No comments:
Post a Comment