Write a program in c using only loops to print *
* *
* *
*******
Answers were Sorted based on User's Feedback
Answer / evr
This is the generic code for printing above such pattern. You can print the above pattern for different number of rows by entering different value during run time
#include<stdio.h>
int main()
{
int n, i, j;
printf("Enter the number of rows:");
scanf("%d",&n);
for(i=0;i<n;i++)
if(i!= n-1)
{
for(j=1;j<=2*n;j++)
{
if(j==n-i || j==n+i)
printf("*");
else
printf(" ");
}
printf("\n");
}
else
for(i=0;i<2*n-1;i++)
printf("*");
return 0;
}
Thank you......
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / veera
#include<stdio.h>
#include<math.h>
main()
{
clrscr();
printf("*");
printf("\n");
printf("* *");
printf("\n");
printf("* *");
printf("\n");
printf("*******");
getch();
}
| Is This Answer Correct ? | 2 Yes | 4 No |
What does %p mean c?
What is n in c?
write a c program to change only the 3rd bit of the particular number such that other bits are not affected.. if bitnum=10(say.. it can be any no..
write a program to concatenation the string using switch case?
What are the storage classes in C?
What is the description for syntax errors?
What are the types of operators in c?
How can I read a directory in a C program?
2 Answers Bright Outdoor, Wipro,
pgm in c to reverse string by word using array(god is love becomes love is god) (no additional array can used,space is only delimiter between words )
Program to find the absolute value of given integer using Conditional Operators
Is the following code legal? struct a { int x; struct a b; }
What is the purpose of the fflush() function in C?