printf() Function

printf(“Programming is fun.\n”);

In C programming, printf() is a standard library function used for printing formatted output to the console or other output streams. It stands for "print formatted" and is part of the <stdio.h> header file. The parameter or argument to be passed to the printf routine is the string of characters “Programming is fun.\n”

\n

Any characters to be printed after the newline character then appear on the next line of the display.


Using printf();

1)

#include<stdio.h>
int main()
{
printf("In C, lowercase letters are significant.\n");
printf("main is where program execution begins.\n");
        printf("Opening and closing braces enclose program statements in a routine.\n");
        printf("All program statements must be terminated by a semicolon.\n");
return 0;
}

Output👇




2)

#include <stdio.h>    
int main(){    
printf("*\n");
printf("**\n");
printf("***\n");
printf("****\n");
printf("*****\n");
printf("******\n");    
return 0;   

Output👇 








3)

#include <stdio.h>    
int main(){    
printf("*******\n");
printf("*******\n");
printf("*******\n");
printf("*******\n");
printf("*******\n");  
return 0;   
}

Output👇




4)

#include <stdio.h>    
int main(){    
printf("******\n");
printf("*****\n");
printf("****\n");
printf("***\n");
printf("**\n"); 
printf("*\n"); 
return 0;   
}  

Output👇





5)

#include <stdio.h>    
int main(){    
printf("     *\n");
printf("    **\n");
printf("   ***\n");
printf("  ****\n");
printf(" *****\n");
printf("******\n"); 
return 0;   
}  

Output👇





6)

#include <stdio.h>    
int main(){    
printf("******\n");
printf(" *****\n"); 
printf("  ****\n");
printf("   ***\n");
printf("    **\n");
printf("     *\n");
return 0;   
}  

Output👇





7)

#include <stdio.h>    
int main(){    
printf("1\n");
printf("12\n"); 
printf("123\n");
printf("1234\n");
printf("12345\n");
return 0;   
}  

Output👇








8)

#include <stdio.h>    
int main(){    
printf ("Testing...");
printf ("....1");
printf ("...2");
printf ("..3");
printf ("\n"); 
return 0;   
}  

Output👇

Comments

Popular posts from this blog

Programming Errors in C

Simple and basic C program code