Saturday, 12 November 2016

Input & Output funtions

Tags


Input and output instruction  in c language.



printf() and scanf() are input and output instruction in C language.

Both are written in small alphabets because c is case sensitive language.

printf():- printf() is predefined functions. It is not a keyword.we can use printf() to print text as it is and we also print value of expression or value of variables.

So, printf() is a function in which you can write anything in paranthesis with double codes.

Ex;

main()

{

clrscr();//it erases old content and it clears screen

printf(“anything you want to print \n”);//\n is used as new line character

printf(“sachin”);

getch();//taking one character.

}

Note:-In output screen maximum 80 character print horizontally in one line and and 25 line vertically.



gotoxy(25,13)// this function is used to find your cursor in any area in your output screen.

/* format specifier

%d for integers.

%f for float.

%lf for double.

*/



scanf():-

scanf() is predefined function which is used to take input from user



ex;

main()

{



Int n;

Clrscr();

scanf(“%d”,n);

getch();

}