Earn while u Learn

Tips tweaks hacks on computer with C C++ VB tutorials and ways to earn money online

ad
Showing posts with label Inpot output statament in C. Show all posts
Showing posts with label Inpot output statament in C. Show all posts

Inpot output statament in C

printf() is a standard output function of C. It is used to display outputs generated by a program on the screen.
            Syntax:   printf(" [ message ] [conversion specifier] [escape sequences]",[variable list>/[expression>);
             Ex: printf("welcome to www.a2zhacks.blogspot.com ");
    the above statement will display a message Welcome to www.a2zhacks.blogspot.com  on the screen
Example:  #include
               main()
               {
                int x=67;
                printf(" The value of x = %d",i);
                }
the output of the above code is The Value of x = 67.

scanf() this is a standard input function of C. This function is used to accept any value or store in the given address of the specified variable according to the conversion specifier.
syntax:   scanf("[conversion specifier list]",[&var1,&var2,&var3.....]);
example:
#include
main()
{
int x;
printf("Enter a number");
scanf("%d",&x);
printf("The number you entered is  %d ",x);
getch()
}
the output will be that you will be asked a number and then the number will be stored in x and you will get a message that the number you entered is 123.

Sign in / Join

Labels