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 |
c program to add and delete an element from circular queue using array
What are the 3 types of structures?
explain memory layout of a C program
void main() { int i=5; printf("%d",i+++++i); }
How to draw the flowchart for structure programs?
main() { int x, arr[8]={11,22,33,44,55,66,77,88}; x=(arr+2)[3]; printf(ā%dā,x); }
Define macros.
what does " calloc" do?
how to add numbers without using arithmetic operators.
if ENTERED FIVE DIGITS DESIGN A PROGRAM THAT WILL FIND CORRESPONDING VALUE FROM ASCII TABLE
#include <stdio.h> #define sqr(x) (x*x) int main() { int x=2; printf("value of x=%d",sqr(x+1)); } What is the value of x?
16 Answers Accel Frontline, Opera, Oracle,
In c programming language, how many parameters can be passed to a function ?