How to start the real program ? | My Coding!

Tuesday 3 February 2015

// // Leave a Comment

How to start the real program ?



Hi guys

Let's start the real program

Eaxample 1:
#include <stdio.h>
void main()
{
   clrscr();
   printf("\n Hello world")
   getch();
}
Explanation : In above program #include is a preprocesser, it is predefined directory. "stdio.h" is a header file which means standard input output, it is a header file which defines input output operation.

The function clrscr() clear the screen. In c program , when the program is execute it also display the previous output of program. So whenever you execute you have to clear it before the execution of new program.

The function getch() is used to hold the screen. It is mostly use with Turbo C. But if you have advance version like C free , you don't need to write it.

Example 2:
Take the input from user and to display it.
#include <stdio.h>
void main()
{
 int  x ;
clrscr();
printf("\nEnter a number : ")
scanf("%d ", &x);
 printf("\nYour number is %d : ", x )
getch();
}
Explanation :-  The printf() function is used to display the item.
scanf () function is used to store the values.




0 comments:

Post a Comment