1.There are many predefined function in the library of c.
2.printf and scanf are the predefined function.
3.They are commonly used for input and output operation.
4.printf and scanf both are predefined in stdio.h header file.
What is printf function ?
1.It is a predefined function.
2.It is used to print information or data on to the output screen.
3.It is predefined in the stdio.h header file.
4.printf is case sensitive means Printf is wrong,so it must be in lowercase.
Syntax pf printf
printf(format_specifier,variable_name);
What is scanf function ?
1.It is a predefined function.
2.It is used to take user input at the time of execution of program.
3.It is also predefined in the stdio.h header file.
4.scanf is case sensitive means Scanf is wrong,so it must be in lowercase.
printf and scanf with integer
#include<stdio.h> int main() { int rollno;//declaring integer variable printf("Enter your roll no\n"); scanf("%d",&rollno); printf("Roll no=%d",rollno); } ### Output ### Enter your roll no 204 Roll no=204
#include<stdio.h> int main() { float marks;//declaring float variable printf("Enter your marks\n"); scanf("%f",&marks); printf("Marks=%f",marks); } ### Output ### Enter your marks 82.3 Marks=82.3
#include<stdio.h> int main() { char grade;//declaring character variable printf("Enter your grade\n"); scanf("%c",&grade); printf("Grade=%c",grade); } ### Output ### Enter your grade A Grade=A
#include<stdio.h> int main() { char name[50];//declaring character variable printf("Enter your name\n"); scanf("%s",&name); printf("Name=%s",name); } ### Output ### Enter your name Rockey Name=Rocky
Here
I am requesting if you found this post was helpful for you then let me
know by your comment in below comment box and share it with your friend.
Also you can contact me on Instagram @rajusunagar_
If
you have not subscribed my website then please subscribe my website.
Try to learn something new and teach something new to other.
Thank you!!.......
0 Comments