C Programming

Write the difference between scanf() and printf().

scanf() printf() 1. It means scanning format. So it is an input formatting function. 1. It’s printed format. So, for formatted output it is used. 2. Syntax:scanf(control sequence, var-1,var-2…); 2. Syntax:printf(control sequence, var-1.var-2;……); ORprint(strings); 3. Example:void main(){int x,y;printf (“Enter any two integers” );scanf(“%d%d”,&x,&y);printf(“x=%d,y=%d\n”,x,y);getch();} 3. Example:void main(){float x,y;printf (“Enter any two floats” );scanf(“%f%f”,&x,&y);printf(“x=%2f,y=%2f\n”,x,y);getch();} 

C Programming

C “Hello, World!” Program

In this example, in C programming you’ll learn to print “Hello, World!” on the screen. C Program to Display “Hello, World!” Output Hello, World! How does the program “Hello, World!” work? The #include is a preprocessor command which tells the compiler to include stdio.h (standard input and output) file content into the program. The file stdio.h includes functions such as scanf() […]