Pages

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

Monday, May 5, 2008

001: Book 1,Chapter 1,Problem 1

Problem statement:
1.1 Write a program that will print your mailing address in the following form:
First Line : Name
Second Line: Door No, Street
Third Line : City, Pin Code*


Solution:
All the program wants to test is if you know to use the new line character. That's all really.


Program:

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

int main()
{
printf("XYZ,\n10, Downing Street,\nLondon, 123456");
getch();
return 0;
}


Output:
XYZ,
10, Downing Street,
London, 123456

Description:
To know more about these terms, click on them.
stdio.h
conio.h
getch()
/* */-Comment Lines


*In India wa have a 6 digit Pin Code just as in USA they have a 5 digit Zip Code

No comments: