Главная

Популярная публикация

Научная публикация

Случайная публикация

Обратная связь

ТОР 5 статей:

Методические подходы к анализу финансового состояния предприятия

Проблема периодизации русской литературы ХХ века. Краткая характеристика второй половины ХХ века

Ценовые и неценовые факторы

Характеристика шлифовальных кругов и ее маркировка

Служебные части речи. Предлог. Союз. Частицы

КАТЕГОРИИ:






Float a,b,c,d,average;




printf("Enter three numbers:");

scanf("%f %f %f",&a,&b,&c);

d=a+b+c;

average=d/3.0;

printfC'The average i s %f", average,);



Comment Lines

A C source program consists of statements and comment lines. Comment lines are enclosed by the characters /* (at the start of the comment) and 7 (at the end of the comment).

The Function main{ }

Every C program must have a function called main which must appear s only once in a program. The parentheses following the word main must be present, but there must be no parameters included. The main part of the program is enclosed within braces {}, and consists of declaration statements, assignment statements, and other C functions. In the above program there are six statements within the braces: a declaration

10 statement (the first statement of the main program starting with the word float), two assignment statements (the fourth and fifth statements starting with the variable names d and average), and three function statements, two to print information on the screen and one to scan the keyboard for input.

15 As C is a free form language, the semicolon (;) at the end of each line is a must. It acts as a statement terminator, telling the compiler where an instruction ends. Free form means that statements can be identified and blank lines inserted in the source file to improve readability, and statements can span several lines. However, each statement must be

20 terminated with a semicolon. If you forget to include the semicolon, the compiler will produce an error, indicating the next line as the source of the error. This can cause some confusion, as the statement objected to can be correct, yet as a syntax error is produced.






Не нашли, что искали? Воспользуйтесь поиском:

vikidalka.ru - 2015-2024 год. Все права принадлежат их авторам! Нарушение авторских прав | Нарушение персональных данных