Write a program to give following output.....
*********
**** ****
*** ***
** **
* *
** **
*** ***
**** ****
*********
Answer Posted / monty
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
for(a=1;a<10;a++)
{
for(b=1;b<10;b++)
{
if((a==2 && b==5) ||
(a==3 && (b==4 || b==5 || b==6) )
||
(a==4 && (b>=3 && b<=7) )
||
(a==5 && (b>=2 && b<=8) )
||
(a==6 && (b>=3 && b<=7) )
||
(a==7 && (b==4 || b==5 || b==6) )
||
(a==8 && b==5))
printf("-");
else
printf("*");
}
printf("\n");
}
getch();
}
Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
What is the difference between a function and a method in c?
Explain indirection?
Explain how can I right-justify a string?
What is #define size in c?
How can I call fortran?
What are pointers? Why are they used?
Do array subscripts always start with zero?
How can I call a function with an argument list built up at run time?
What are variables c?
How do you write a program which produces its own source code as output?
Is using exit() the same as using return?
What is the difference between exit() and _exit() function in c?
Can a pointer be null?
What is main () in c?
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12