Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- challenge1_v1.c
- Challenge from Amit Singh Raghuvanshi
- https://web.facebook.com/amitsingh.amitsingh.395
- https://web.facebook.com/photo/?fbid=2211324442346784&set=gm.1600975926727918
- Try in less lines of code. Here is his try:
- https://pastebin.com/RBUpTgRH
- Below I changed his code which is now properly indent
- but still doesn't look like the image.
- You can find all my C programs at Dragan Milicev's pastebin:
- https://pastebin.com/u/dmilicev
- */
- #include <stdio.h>
- int main()
- {
- char a[]="*S*R*I* *R*A*M*";
- int i,j;
- for(i=0;i<2*15+1;i++)
- {
- for(j=0;j<2*15+1;j++)
- {
- if(i==0||i==2*15||j==0||j==2*15)
- printf("* ");
- else if(i==1||j==1||i==2*15-1||j==2*15-1)
- {
- if(j%2==1&&i%2!=0)
- {
- if(i==1)
- printf("%c ",a[j/2]);
- else if(j==1)
- printf("%c ",a[i/2]);
- else if(j==2*15-1)
- printf("%c ",a[15-i/2-1]);
- else
- printf("%c ",a[15-j/2-1]);
- }
- else
- printf("* ");
- }
- else if((i==2&&j>=2)||(i==2*15-2&&j<=2*15-2)||(j==2&&i>=2)||(j==2*15-2&&i<=2*15-2))
- printf("* ");
- else if(i==j||i==(2*15-j))
- printf("* ");
- else
- printf(" ");
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement