Pages

Of Computers, troubles and my Experiments with programming as a beginner.

Sunday, May 11, 2008

003:Book 1,Chapter 1,Program 3

Problem Statement:
1.3 Write a program using one printf statement to print the patter on asterisks as shown below
*
**
***

Solution:
Yet anoter program that tests to see if you have gotten your newline character memorised. :D

Program:
/*Program 1.1.3 */
#include stdio.h
/*This is a header file.*/
#include
/*This is another header file that we require for using getch()*/

int main()
{
printf("*\n**\n***");
getch();
return 0;
}

Output:
*
**
***

Description:
Simple stuff really. I don't reckon there's much to explain.



There is a problem with headers in all of my programs. They are supposed to be typed as lessthansybolheadername.hgreaterthansymbol. That messes with the code and hence the Less than and greater than symbol do not display. :(

No comments: