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

plz let me know how to become a telecom protocol tester. thank you.

2190


What is the heap in c?

1082


what are enumerations in C

1163


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

1220


What is the function of this pointer?

1341


What does #pragma once mean?

1164


What is the difference between if else and switchstatement

1933


main() { printf("hello"); fork(); }

1196


Explain null pointer.

1119


How is a pointer variable declared?

1094


What is the use of parallelize in spark?

1030


How can I avoid the abort, retry, fail messages?

1138


write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a

1953


what is stack , heap ,code segment,and data segment

2697


What are variables and it what way is it different from constants?

1243