write a program in c to print ****
* *
* *
****



write a program in c to print **** * * ..

Answer / rajkumar

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
for(i=0;i<=3;i++)
{
printf("*");
}
for(i=4;i<5;i++)
{
printf(" ");
}
for(i=5;i<6;i++)
{
printf("*");
}
for(i=6;i<7;i++)
{
printf(" ");
}
for(i=7;i<8;i++)
{
printf("*");
}
for(i=8;i<9;i++)
{
printf(" ");
}
for(i=9;i<10;i++)
{
printf("*");
}
for(i=10;i<11;i++)
{
printf(" ");
}
for(i=11;i<12;i++)
{
printf("*");
}
for(i=12;i<13;i++)
{
printf(" ");
}
for(i=12;i<=15;i++)
{
printf("*");
}
getch();
}

Is This Answer Correct ?    2 Yes 5 No

Post New Answer

More C Interview Questions

What is the difference between declaring a variable and defining a variable?

0 Answers  


can v write main() { main(); } Is it true?

6 Answers  


Is both getch() and getchar() functions are similar? if it is similar means why these two functions are used for same usage? if it is not similar means what is the difference?

1 Answers   Infosys,


what will be the output of the following program, justify? #define TEST int TEST getdata() { static i; i+=10; return i; } main() { int k; k = getdata(); }

3 Answers  


Explain output of printf("Hello World"-'A'+'B'); ?

0 Answers  






What's the best way of making my program efficient?

0 Answers   Celstream,


What is a pragma?

0 Answers  


What are the types of pointers?

0 Answers  


enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }

4 Answers   ME,


what is the difference between c and java?

1 Answers  


What is the difference between constant pointer and pointer to a constant. Give examples.

4 Answers   TCS,


What is use of null pointer in c?

0 Answers  


Categories