Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

[Homework] Loading and finding integers in an array


This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1 Kaiser


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 24 November 2015 - 06:27 PM

1. Write pseudocode to solve the following problem. 
(i) Declare an array nums that can hold 100 real numbers. 
(ii) Write pseudocode to load nums with 100 values, entered via the keyboard. Assume all data are valid. 
(iii) Write pseudocode to prompt for an integer target. Search array nums for target. If found, print the location where target was found. Otherwise, print “Not found”. 
(iv) Briefly explain how your response to 1 (ii) would change if the input data is stored in a file instead of being read via the keyboard. Note: No pseudocode is necessary. Only an explanation is need. 
2. A file “input.dat” exists and is loaded with several positive integers. Each integer is separated by at least one space and the last value in the file is -1, which signifies the end of the data. Assume all data are valid. 
Write pseudocode to read the values in the file and find and print the sum of all integers in the file that are greater than 50. For example, if the file contains 
5 70 10 3 80 100 -1 
you are only to find the sum of the integers 70, 80 and 100.



#2 mayasim


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 24 December 2015 - 07:51 AM

hey how did u get it all.Good!keep it up bro

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download