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 |
Write a program which returns the first non repetitive character in the string?
Why is void main used?
How can you access memory located at a certain address?
Determine if a number is a power of 2 at O(1).
What is a #include preprocessor?
code snippet for creating a pyramids triangle ex 1 2 2 3 3 3
int n=1; while(1) { switch(n) { case 1:printf("a"); n++; continue; case 2:printf("b"); n++; continue; default : printf("c"); break; } break; }
What is the difference between printf and scanf in c?
Write programs for String Reversal & Palindrome check
how to make c program without a libary? e.g.#include<stdio.h> libary is not in c progaram.
write a function for strtok()??
What is the maximum length of an identifier?