w3resource logo


C Programming Exercises

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

Secondary Nav

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.

Expected Output :

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

C Code:

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

	return(0);
}

Solution

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

	return(0);
}

Improve this sample solution and post your code through Disqus.



Join our Question Answer community to learn and share your programming knowledge.

Help the community:

Python: Fizzbuzz

C++: Decimal to binary conversion

JavaScript: Need Help in JavaScript

Python: Help me with this program