Could you tell me how can I do this kind of question.

Thread Solved

Join Date: Feb 2009
Posts: 111
Reputation: turbomen is an unknown quantity at this point 
Solved Threads: 0
turbomen turbomen is offline Offline
Junior Poster

Could you tell me how can I do this kind of question.

 
0
  #1
Oct 12th, 2009
Dear ALL,

Could you tell me how can I do this kind of question if I do not working with the computer and please find the attached document for your reference - it is the answer of the question?

Pascal and Delphi Syntax (Toggle Plain Text)
  1.  
  2. Complete the table below to show what each variable holds, the user enters the numbers 5, 6, 7, 8, 9
  3.  
  4. evens:=0;
  5. for count:= 1 to 5 do
  6. begin
  7. writeln('Please enter a number');
  8. readln(numbers[count]);
  9. if (numbers[count] mod 2 = 0) then
  10. begin
  11. evens := evens + 1;
  12. end
  13. end;
  14. writeln(evens);
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 111
Reputation: turbomen is an unknown quantity at this point 
Solved Threads: 0
turbomen turbomen is offline Offline
Junior Poster
 
0
  #2
Oct 12th, 2009
It is the attached document.
Attached Thumbnails
q2.jpg  
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,086
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 179
Sponsor
pritaeas's Avatar
pritaeas pritaeas is online now Online
Veteran Poster
 
0
  #3
Oct 12th, 2009
The way I read this, is that you need to calculate the value of the variable (evens). Just follow the source code in your head, or on paper, and do as it instructs.

I don't see output in the code, so I'm not sure what they mean by that.
Last edited by pritaeas; Oct 12th, 2009 at 6:19 am.
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 111
Reputation: turbomen is an unknown quantity at this point 
Solved Threads: 0
turbomen turbomen is offline Offline
Junior Poster
 
0
  #4
Oct 12th, 2009
Thank you for your prompt reply. Yes, I want to calculate the value of the variable (evens). Just follow the source code in my head, or on paper. But how can I do in this way?

Maybe, it is not useful for me to work on the computer for this kind of question.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,086
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 179
Sponsor
pritaeas's Avatar
pritaeas pritaeas is online now Online
Veteran Poster
 
1
  #5
Oct 12th, 2009
Try it on paper. Write the values down. Then change them as you walk through each loop (in your head).
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Pascal and Delphi Forum


Views: 640 | Replies: 4
Thread Tools Search this Thread



Tag cloud for Pascal and Delphi
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC