w3resource logo

:

C Programming Exercises

C Exercises: Print a block F using hash (#)

C Basic Declarations and Expressions: Exercise-2 with Solution

Write a C program to print a block F using hash (#), where the F has a height of six characters and width of five and four characters.

C Code:

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

	return(0);
}

Sample Output:

######                                                                 
#                                                                      
#                                                                      
#####                                                                  
#                                                                      
#                                                                      
# 

Solution

Improve this sample solution and post your code through Disqus