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

What has to put when we are inserting as assembly language code into the C code? or When we are inserting as assembly language code into the C code we have to insert one thing at the start and of the assembly language. What are they?

2 Answers  


what is the difference between c and java?

1 Answers  


How the c program is executed?

0 Answers  


What is character set?

0 Answers  


How to print "Hi World" without using semi colon?

6 Answers   Infosys,






12. Look at the Code: main() { int a[]={1,2,3},i; for(i=0;i<3;i++) { printf("%d",*a); a++; } } Which Statement is/are True w.r.t the above code? I.Executes Successfully & Prints the contents of the array II.Gives the Error:Lvalue Required III.The address of the array should not be changed IV.None of the Above. A)Only I B)Only II C)II & III D)IV

4 Answers   Accenture,


Find errors (1) m = ++a*5; (2) a = b ++ -c*2; (3)y = sqrt (1000);

5 Answers  


what is the similarities between. system call and library function?

1 Answers   Wipro,


What are 3 types of structures?

0 Answers  


wat is the output int main() { char s1[]="Hello"; char s2[]="Hello"; if(s1==s2) printf("Same"); else printf("Diff"); }

3 Answers  


what is mallloc()?how it works?

4 Answers   Excel,


write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD DCBA ABC CBA AB BA A A

17 Answers   ABC, College School Exams Tests,


Categories