#include <stdio.h> // Function to print the top part of the decorative box void print_top() { printf("/\\/\\/\\/\\/\\\n"); } // Function to print the bottom part of the decorative box void print_bottom() { printf("\\/\\/\\/\\/\\/\n"); } // Function to print the middle part of the decorative box void print_middle(int how_many) { for (int i = 0; i < how_many; i++) { printf("\\ /\n"); printf("/ \\\n"); } } // Main function to demonstrate the functionality int main() { int how_many; // Prompt the user for the number of middle parts printf("How many middle parts? \n"); scanf("%d", &how_many); // Print the top part print_top(); // Print the middle part specified number of times print_middle(how_many); // Print the bottom part print_bottom(); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter