does anyone know pascal? because i'm having trouble running a program code i made. It won't load?
does anyone know pascal? because i'm having trouble running a program code i made. It won't load?
You should probably post the code you're using, and be more specific with your problem.
Post the code already. I know a bit of pascal.
alright relax dudes..
PROGRAM Expressions1(OUTPUT);
BEGIN
WRITELN;
WRITELN('A. 15 - 15 DIV 15 = ',15-15 DIV 15);
WRITELN('B. 22 + 10 / 2 = ', 22+10/2:0:2);
WRITELN('B. (22 + 10) / 2 = ', (22+10)/2:0:2);
WRITELN('C. 50 * 10 - 4 MOD 3 * 5 + 80 = ',50*10-4 MOD 3*5+80);
WRITELN('Press ENTER to continue..');
READLN
END.
my problem is getting the "RUN" function to do its job and display the output program of the code.
I don't know what version of Pascal you are using. I am only guessing what you are trying to achieve not having seen the exercise question. If you look at the modified program below(MS-DOS Pascal 6) it might give you an idea where you have gone wrong.
PROGRAM Expressions1(OUTPUT);
BEGIN
WRITELN;
WRITE('A. (15 minus 15) divided by 15 = , ');
WRITELN((15-15)/15);
WRITE('B. (22 plus 10) divided by 2 = , ' );
WRITELN((22+10)/2);
WRITE('C. (50 multiplied by 10 minus 4) divided by 3 multiplied by 5 plus 80 = , ');
WRITELN(((50*10)-4) MOD ((3*5)+80));
WRITELN('Press ENTER to continue..');
READLN
END.
When doing calculations always do your first calculation inside brackets e.g(10+2). Then add your second calculation enclosing both calculations in brackets e.g.((10+2) * 6) otherwise Pascal will calculate in the following order: *,/,-,+ and that won't necessary give you the result that you originally wanted;
10+2 * 6 = 22.
((10+2) * 6) = 72
Good luck.
Last edited by bigboab; 04-19-2009 at 06:25 AM.
Age is getting to me. I thought patio doors was an Irish country singer.
Bookmarks