Hi, I'm looking for with some pascal code. I have to make a program which allows you to input a name and an amount four times. Then it is supposed to output the name, three percentages of the amount and the maximum of one of the percentage out of the four outputted results. can any one help? This is what I have so far:

program grocery;
uses wincrt;
var
Name:Array[1..4] of String;
Amount:Array[1..4] of longint;
i:Integer;
B_sector,L_sector,V_sector:double;
Begin
For i:=1 to 4 do
Begin;
Writeln('Enter Organisation Name');
Readln(Name[i]);
Writeln('Enter the amount');
Readln(Amount[i]);
B_sector:=(Amount[i])*40/100;
V_sector:=(Amount[i])*25/100 ;
L_sector:=(Amount[i])*35/100 ;
Writeln(Name[i]);
Writeln(B_sector:2:1);
Writeln(V_sector:2:1);
Writeln(L_sector:2:1);

End;

End.

program grocery;
uses wincrt;
var
Name:Array[1..4] of String;
Amount:Array[1..4] of longint;
i:Integer;
B_sector,L_sector,V_sector:double;
Begin
For i:=1 to 4 do
Begin{;}
Writeln('Enter Organisation Name');
Readln(Name);
Writeln('Enter the amount');
Readln(Amount);
B_sector:=(Amount)*(40/100);
V_sector:=(Amount)*(25/100);
L_sector:=(Amount)*(35/100);
Writeln;
Writeln(Name);
Writeln(B_sector:2:1);
Writeln(V_sector:2:1);
Writeln(L_sector:2:1);
Writeln;
End;
Readln;
End.

Hi, I'm looking for with some pascal code. I have to make a program which allows you to input a name and an amount four times. Then it is supposed to output the name, three percentages of the amount and the maximum of one of the percentage out of the four outputted results. can any one help? This is what I have so far:

program grocery;
uses wincrt;
var
Name:Array[1..4] of String;
Amount:Array[1..4] of longint;
i:Integer;
B_sector,L_sector,V_sector:double;
Begin
For i:=1 to 4 do
(* right here you remove the ; in the following line *)
Begin;
(* and your problem is solved *)
Writeln('Enter Organisation Name');
Readln(Name[i]);
Writeln('Enter the amount');
Readln(Amount[i]);
B_sector:=(Amount[i])*40/100;
V_sector:=(Amount[i])*25/100 ;
L_sector:=(Amount[i])*35/100 ;
Writeln(Name[i]);
Writeln(B_sector:2:1);
Writeln(V_sector:2:1);
Writeln(L_sector:2:1);

End;

End.

(*
I inserted my solution in the code as comments. *)

program grocery;
uses wincrt;
var
Name:Array[1..4] of String;
Amount:Array[1..4] of longint;
i:Integer;
B_sector,L_sector,V_sector:double;
Begin
For i:=1 to 4 do
Begin{;}
Writeln('Enter Organisation Name');
Readln(Name[i]);
Writeln('Enter the amount');
Readln(Amount[i]);
B_sector:=(Amount[i])*(40/100);
V_sector:=(Amount[i])*(25/100);
L_sector:=(Amount[i])*(35/100);
Writeln;
Writeln(Name[i]);
Writeln(B_sector:2:1);
Writeln(V_sector:2:1);
Writeln(L_sector:2:1);
Writeln;
End;
Readln;
End.

Answer:

In the above code you follow a for loop with a line that says "Begin;"
The compiler should halt right there and complain. Remove the semicolon,
and your compiler errors should go away and it should run.

Edited 3 Years Ago by pyTony: fixed formating

This article has been dead for over six months. Start a new discussion instead.