printf Function
This function is used to display text, constant or value of variable on screen in specified format.
Syntax:
Printf(“format string”, argument list);
Types:
#include<stdio.h>
#include<conio.h>
void main (void)
{
printf(“HELLO WORLD!”);
getch();
}
Output
HELLO WORLD!
Syntax:
Printf(“format string”, argument list);
Types:
- printf(“hello world”); // Printf()with no argument list
- printf(“the value of integar=%d”,a); //Printf() with one argument
- printf(“Sum of %d+%d=%d”,a,b,a+b); //Printf()with more than one argument
#include<stdio.h>
#include<conio.h>
void main (void)
{
printf(“HELLO WORLD!”);
getch();
}
Output
HELLO WORLD!
puts function
The function used to display the string value on the screen.
Syntax: Puts(parameter/value/variable);
Example:
#include<stdio.h>
#include<conio.h>
void main ()
{
char name[];
printf("enter your name:");
gets(name);
printf("your name is:");
puts(name);
getch();
}
Output:
Enter your name:somebody
Your name is:somebody
Syntax: Puts(parameter/value/variable);
Example:
#include<stdio.h>
#include<conio.h>
void main ()
{
char name[];
printf("enter your name:");
gets(name);
printf("your name is:");
puts(name);
getch();
}
Output:
Enter your name:somebody
Your name is:somebody