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


Please Help Members By Posting Answers For Below Questions

What is the difference between a function and a method in c?

817


Explain indirection?

883


Explain how can I right-justify a string?

823


What is #define size in c?

872


How can I call fortran?

823


What are pointers? Why are they used?

875


Do array subscripts always start with zero?

1026


How can I call a function with an argument list built up at run time?

929


What are variables c?

827


How do you write a program which produces its own source code as output?

854


Is using exit() the same as using return?

935


What is the difference between exit() and _exit() function in c?

851


Can a pointer be null?

780


What is main () in c?

797


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

854