/*
* calcute area of a rectangle.
*/
#include <stdio.h> /* printf, scanf definitions */
#include <math.h>
int
main (void)
{
double width, /* input - width of rectangle. */
double length, /* input - length of rectangle. */
Area; /* output - area of rectangle */
/* get the width of rectangle. */
printf("Enter width> ");
scanf("%lf", &width);
/* get the length of rectangle. */
printf("Enter length> ");
scanf("%lf", &length);
/*convert to Area or rectangle. */
Area = width * length;
/* display Area of rectangle. */
printf( "The Area is %f . \n", Area);
return (0);
C:\Users\student\Documents\area.c(10): error #2092: Missing identifier.
C:\Users\student\Documents\area.c(10): error #2001: Syntax error; found 'double' expecting ';'.
*** Error code: 1 ***
Quote from: dnasty54 on September 30, 2014, 02:16:33 AM
/*
* calcute area of a rectangle.
*/
#include <stdio.h> /* printf, scanf definitions */
#include <math.h>
int
main (void)
{
double width, /* input - width of rectangle. */
double length, /* input - length of rectangle. */
Area; /* output - area of rectangle */
C:\Users\student\Documents\area.c(10): error #2092: Missing identifier.
C:\Users\student\Documents\area.c(10): error #2001: Syntax error; found 'double' expecting ';'.
*** Error code: 1 ***
Well, just read the error messages, they point exactly to the problem, in particular the second one... :!:
Correctly the snippet would be written
double width; /* input - width of rectangle. */
double length; /* input - length of rectangle. */
double Area; /* output - area of rectangle */
Punctuation to terminate statements matters! ;)
Ralf
now i have those same errors twice!! :-[ :-[
Quote from: dnasty54 on September 30, 2014, 02:41:22 AM
now i have those same errors twice!! :-[ :-[
Post your complete code, surrounded by code tags, please...
Ralf
nevermind i see what u were saying about the ;'s thanks alot!!
#include <stdio.h>
#include <math.h>
int main (void)
{
double width;
double length;
double Area;
/* get the width of rectangle. */
printf("Enter width> ");
scanf("%lf", &width);
/* get the length of rectangle. */
printf("Enter length> ");
scanf("%lf", &length);
/*convert to Area or rectangle. */
Area = width * length;
/* display Area of rectangle. */
printf( "The Area is %f . \n", Area);
return 0;
}
*make sure that when u open a brace, u close it after your 'return 0;'
*clearly read the errors, double-click each to see in which line the error is
*each instruction ends by a ';' not a ','