/// C code
// This program will calculate the perimeter of a right triangle.
// Developer: Faculty CMIS102
// Date: Jun 22, 2018
#include <stdio.h>
int main ( )
{
/* variable definition: */
float base, length1, length2;
/* Prompt user for base */
printf ( "Enter the base of the triangle: 10 \n " ) ; // Input the base
/* Prompt user for length1 of a triangle */
printf ( "Enter the length of one side of the triangle: 13 \n " ) ; // Input the length1
/* Prompt user for length2 of a triangle */
printf ( "Enter the length of one side of the triangle: 9 \n " ) ; // Input the length2
// Calculate the Perimeter
perimeter= 10 + 13 + 9 ;
// Print the result
printf ( "Perimeter is : %f\n " , Perimeter
) ; return 0 ;
}
Ly8vIEMgY29kZQovLyBUaGlzIHByb2dyYW0gd2lsbCBjYWxjdWxhdGUgdGhlIHBlcmltZXRlciBvZiBhIHJpZ2h0IHRyaWFuZ2xlLgovLyBEZXZlbG9wZXI6IEZhY3VsdHkgQ01JUzEwMgovLyBEYXRlOiBKdW4gMjIsIDIwMTgKI2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbiAoKSAKewogIC8qIHZhcmlhYmxlIGRlZmluaXRpb246ICovCiAgZmxvYXQgYmFzZSwgbGVuZ3RoMSwgbGVuZ3RoMjsKICAvKiBQcm9tcHQgdXNlciBmb3IgYmFzZSAqLwogIHByaW50ZigiRW50ZXIgdGhlIGJhc2Ugb2YgdGhlIHRyaWFuZ2xlOiAxMCBcbiIpOwogIC8vIElucHV0IHRoZSBiYXNlCiAgc2NhbmYoIiVmIiwgJmJhc2UpOwogIC8qIFByb21wdCB1c2VyIGZvciBsZW5ndGgxIG9mIGEgdHJpYW5nbGUgKi8KICBwcmludGYoIkVudGVyIHRoZSBsZW5ndGggb2Ygb25lIHNpZGUgb2YgdGhlIHRyaWFuZ2xlOiAxMyBcbiIpOwogIC8vIElucHV0IHRoZSBsZW5ndGgxCiAgc2NhbmYoIiVmIiwgJmxlbmd0aDEpOwogIC8qIFByb21wdCB1c2VyIGZvciBsZW5ndGgyIG9mIGEgdHJpYW5nbGUgKi8KICBwcmludGYoIkVudGVyIHRoZSBsZW5ndGggb2Ygb25lIHNpZGUgb2YgdGhlIHRyaWFuZ2xlOiA5IFxuIik7CiAgLy8gSW5wdXQgdGhlIGxlbmd0aDIKICBzY2FuZigiJWYiLCAmbGVuZ3RoMik7CiAgLy8gQ2FsY3VsYXRlIHRoZSBQZXJpbWV0ZXIKICBwZXJpbWV0ZXI9IDEwICsgMTMgKyA5OwogIC8vIFByaW50IHRoZSByZXN1bHQKICBwcmludGYoIlBlcmltZXRlciBpcyA6ICVmXG4iLCBQZXJpbWV0ZXIpOwpyZXR1cm4gMDsKfQo=
compilation info
prog.c: In function ‘main’:
prog.c:24:3: error: ‘perimeter’ undeclared (first use in this function)
perimeter= 10 + 13 + 9;
^~~~~~~~~
prog.c:24:3: note: each undeclared identifier is reported only once for each function it appears in
prog.c:26:33: error: ‘Perimeter’ undeclared (first use in this function)
printf("Perimeter is : %f\n", Perimeter);
^~~~~~~~~
stdout