Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using the Asterisk and other characters on your keyboard, write a unique and original C program that outputs a simple shape or image. For example,
Using the Asterisk and other characters on your keyboard, write a unique and original C program that outputs a simple shape or image.
For example, you could output a Circle or X or other object based on a few println calls.
Include your code and a screen capture of you running the code.
EX ONLY:
The program I wrote creates a diamond pattern using '*'s
#includeint main() { int i, j, n, spaces; char ch = '*'; n = 5; spaces = n-1; for(i = 1; i <= n; i++) { for(j = 1; j <= spaces; j++) { printf(" "); } spaces--; for(j = 1; j <= 2 * i - 1; j++) { printf("%c", ch); } printf(" "); } spaces = 1; for(i = 1; i <= n; i++) { for(j = 1; j <= spaces; j++) { printf(" "); } spaces++; for(j = 1; j <= 2 * (n - i)- 1; j++) { printf("%c", ch); } printf(" "); } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started