Asked by k
Write a program to read the names and age of 10 people and print the name of the oldest person.assume that there are no person of the same age.data is supplied in the following form:name,age,name,age
Answers
Answered by
Steve
max = 0
maxname = ""
for i=1 to 10
read name,age
if age > max then
max=age
maxname=name
end if
next i
print "The oldest person is ",maxname
maxname = ""
for i=1 to 10
read name,age
if age > max then
max=age
maxname=name
end if
next i
print "The oldest person is ",maxname
There are no AI answers yet. The ability to request AI answers is coming soon!