Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Hi can anyone tell me how to get the region sales to calculete the whole 8 inputs? What it seems is happening is the a integer is repeating untill 8 but that the program stops at 8 and only adds the first 7. If I put repeat untill a > 8 then it still asks for the 9th region although it does calculate the first 8 which is what I want it to do.
region_sales := 0.0;
total_sales := 0.0;
a := 0;
writeln ('Please enter sales for region ',a);
writeln ('The sales for all regions were ',total_sales:6:2);
a := a + 1;
total_sales := total_sales + region_sales;
until a = 8;
Thanks for any help
Oh yeah and I tried using the while statement (while total_sales > 9 do) but that keeps asking me for the 9th region before calculating the first 8 too.
0 · ·