Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a program in c using only loops to print *
* *
* *
*******

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the ternary tree?

1021


What is #include stdlib h?

1103


Can the curly brackets { } be used to enclose a single line of code?

1160


What is the use of structure padding in c?

1055


What is the use of in c?

1022


Explain the concept and use of type void.

1110


Are there constructors in c?

1003


What is the mean of function?

1122


WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER

1856


Why is structure padding done in c?

1127


please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code

2171


i got 75% in all semester am i eligible for your company

2221


What does c mean before a date?

1171


write a c program to find the sum of five entered numbers using an array named number

2131


why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above

1119