Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

# Pascal Programming

7 replies to this topic

### #1 jahid91

jahid91

• Members
• 38 posts
• OFFLINE
•
• Gender:Male
• Location:london
• Local time:12:36 PM

Posted 30 November 2007 - 04:32 PM

hi there i just got confuse with this formula. i typed the formula for triangle and when i try to compile it an error comes up on the screen and says unknown identifiers and the pointer flashes on the begining of the formula. can you please tell me the solution for it. thanks.
here's my program:

program arae_of_triangle;
uses crt;

var
triangle, base, height : integer;

begin
ClrScr;
WriteLn ('enter the base of the triangle');
WriteLn ('now enter the height');
triangle := (base*height)/2;
WriteLn ('the area of the triangle is ', triangle);
end.

### #2 groovicus

groovicus

• Security Colleague
• 9,963 posts
• OFFLINE
•
• Gender:Male
• Location:Centerville, SD
• Local time:05:36 AM

Posted 30 November 2007 - 05:19 PM

The pointer flashes at what part of the formula?

### #3 jahid91

jahid91
• Topic Starter

• Members
• 38 posts
• OFFLINE
•
• Gender:Male
• Location:london
• Local time:12:36 PM

Posted 01 December 2007 - 10:37 AM

the pointer flashes at the end of the formula where the semicolon is. next to the number 2. and also says error 26 type mismatch.

### #4 groovicus

groovicus

• Security Colleague
• 9,963 posts
• OFFLINE
•
• Gender:Male
• Location:Centerville, SD
• Local time:05:36 AM

Posted 01 December 2007 - 11:07 AM

My guess, although I know little about Pascal, is that you are inputting numbers for base and height, that when divided by two, results in a number with decimal values. Decimal values can not be assigned to an Int. What happens if you use 2 for the base, and 2 for the height? Does it work then?

### #5 jahid91

jahid91
• Topic Starter

• Members
• 38 posts
• OFFLINE
•
• Gender:Male
• Location:london
• Local time:12:36 PM

Posted 01 December 2007 - 03:13 PM

the main point of writin this program so that someone can input the base , then the perpendicular height when they input those two number it should give them an appropriate answer. but the main probleam is that the formula isnt working properly.

do you think is there anything wrong with the variables because on the variables i wrote the following sentence:

var
triangle, base, height : integer;

should the triangle be on the variables or i should delete it from there.

### #6 groovicus

groovicus

• Security Colleague
• 9,963 posts
• OFFLINE
•
• Gender:Male
• Location:Centerville, SD
• Local time:05:36 AM

Posted 01 December 2007 - 04:07 PM

Since you ignored the point I was trying to make, why not try this:

WriteLn ('the area of the triangle is ', (base*height)/2);

### #7 jahid91

jahid91
• Topic Starter

• Members
• 38 posts
• OFFLINE
•
• Gender:Male
• Location:london
• Local time:12:36 PM

Posted 02 December 2007 - 01:04 PM

thank you very much it worked.

### #8 groovicus

groovicus

• Security Colleague
• 9,963 posts
• OFFLINE
•
• Gender:Male
• Location:Centerville, SD
• Local time:05:36 AM

Posted 02 December 2007 - 02:31 PM

Do you understand why it worked, and why you had the problem in the first place?

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users