Basic Programming

Case Study


PROBLEM:

Write a program to display the text, This is my first program, on the screen.


SOLUTION:

The program must start with #include as the the program will output text to the sceen.

The main body of the program is contained within curly braces which follow the keyword main().

The text is displayed on the screen using the printf statement. Note that this statement requires a semi--colon at the end to indicate the end of the statement.

Comments have also been included to make the programme easier to understand.


/*My first program
  Written by jmb
  October 1998
*/

#imclude 

main()
{
	printf ("This is my first program \n");
	/*\n is required to produce newline */
}

Back to Main Page for Lecture 1