Write a program in c to print
*
* *
* *
*******



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

Answer / kapil

#include<stdio.h>
void main()
{
int i=0,j=1;
while(i<3)
{
while(j<=7)
{
if(j-i==4||j+i==4)
printf("*");
else
printf(" ");
j++;
}
printf("\n");
i++;
j=1;
}
while(j<=7)
{
printf("*");
j++;
}
}

Is This Answer Correct ?    5 Yes 2 No

Post New Answer

More C Interview Questions

How can I increase the allowable number of simultaneously open files?

1 Answers   CSC,


Why does not c have an exponentiation operator?

0 Answers  


#include main() { char s[] = "Bouquets and Brickbats"; printf(" %c, ",*(&s[2])); printf("%s, ",s+5); printf(" %s",s); printf(" %c",*(s+2)); }

0 Answers   Wilco,


Difference between C and Embedded C?

1 Answers  


How to get string length of given string in c?

0 Answers  






what is linkage error when it occurs in c program

3 Answers  


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

0 Answers   ADP,


What are keywords in c with examples?

0 Answers  


What is a pointer variable in c language?

0 Answers  


a 'c' program to tell that the set of three coordinates lie on a same line

3 Answers   Persistent,


Given a single Linked list with lakhs of nodes and length unknown how do you optimally delete the nth element from the list?

1 Answers   Oracle,


What is variable initialization and why is it important?

0 Answers  


Categories