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 |
Explain what is wrong with this statement? Myname = ?robin?;
What is the process of writing the null pointer?
What are the different pointer models in c?
Is c easy to learn?
how to swap four numbers without using fifth variable?
What is the purpose of sprintf?
What are c header files?
What is a loop?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
what is C?
There are N egg baskets and the number of eggs in each basket is a known quantity. Two players take turns to remove these eggs from the baskets. On each turn, a player must remove at least one egg, and may remove any number of eggs provided they all belong to the same basket. The player picking the last egg(s) wins the game. If you are allowed to decide who is going to start first, what mathematical function would you use to decide so that you end up on the winning side?