1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
arlik [135]
4 years ago
9

How do I write a program in Pascal that finds the index of the minimum number of an array(using Function) and replaces it to a n

umber inputted from the keyboard ?(Input and output of the array is a Procedure).
Computers and Technology
1 answer:
nordsb [41]4 years ago
5 0

Answer:

program arraysminfinder;

procedure minreplace();

var

no: array [1..10] of integer;  (*no is an array of integers, 10 in all *)

a: integer= 0;

i: integer= 0;

c: integer= 0;

k: integer=0;

N: integer=0;

begin

(* We need to first initialize the array no with 0 values *)

for a := 1 to 10 do

no[a]:=0;

c:=no[1];

for a := 1 to 10 do

begin

  if (no[i]<c) then

  begin

   c:=no[i];

   k:=i;

  end

  else

  begin

      i:=i+1;

  end

 end;

  writeln('Enter the new number:');

  read(N);

  no[k]:=N;

  for a := 1 to 10 do

  begin

     writeln('The array elements are:',no[a]);

   end;

end;

begin

end.

Explanation:

The program is as above.  I have used a function, a for loop, an array of integers, and the if then else ladder for getting the desired output as mentioned in the program. If in case you want procedure for input and output, create a procedure like:

procedure replacenum():integer;

Begin

 writeln("Enter the new number:" N);

    no[k]:=N;

   for a := 1 to 10 do

         writeln("The array elements are:"no[a]);

 end.

Similarly you can make a procedure for input.

You might be interested in
How do computers use logic?
madreJ [45]
They don’t use any logic
8 0
4 years ago
Can someone please answer this for me I will answer one of yours.
julsineya [31]
4 is preview i think.
4 0
4 years ago
Differences between placeholders and textbook in PowerPoint ​
Igoryamba

Answer:

fifthly, if it is an empty box. it disappear completely. sixth the size of a text box changes depending on the length of a text that we type . this is in contrast with a place holder box where changes are made of the font of the text

Explanation:

mark me a brainlist

4 0
3 years ago
How to find out where an item was purchased by the upc code?
diamong [38]
There should be a search engine
3 0
3 years ago
What is the main purpose of software imaging?
Irina18 [472]
A is the answer for your question
5 0
4 years ago
Other questions:
  • g Write a program that prompts the user to enter two integers. The program outputs how many numbers are multiples of 3 and how m
    11·1 answer
  • Give one example of a civil engineering structure.
    5·1 answer
  • Knowledge and experience help you
    11·1 answer
  • Prepare a algorithm visualization for the Tower of Hanoi when 4 disks are to be moved from spindle #1 to spindle #3.
    12·1 answer
  • Which print setting enables multiple slides to be printed on one page?
    5·2 answers
  • Which results are expected in a personality test but not a skills assessment?
    13·1 answer
  • Write a method, including the method header, that will receive an array of integers and will return the average of all the integ
    7·1 answer
  • Which components are involved with input? Output? Processing? Storage?
    15·2 answers
  • What is collaboration
    14·1 answer
  • Arrange these steps of creating a presentation in the correct order. (notice that the given order is incorrect other than the ba
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!