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 |
Can you please explain the difference between syntax vs logical error?
Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?
create a C program that displays one z,two y's,three x's until twenty six A's. plzz answer i need it tomorrow.
What functions are used for dynamic memory allocation in c language?
What is the proper way of these job Tell me about there full work
what is out put of the following code? #include class Base { Base() { cout<<"constructor base"; } ~Base() { cout<<"destructor base"; } } class Derived:public Base { Derived() { cout<<"constructor derived"; } ~Derived() { cout<<"destructor derived"; } } void main() { Base *var=new Derived(); delete var; }
Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors
How can I read/write structures from/to data files?
Are the variables argc and argv are always local to main?
Are pointers integer?
What are the phases in s/w developed life cycle? wat is the diff b/w stack & queue...where do we use stack
can you change name of main()?how?