954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

help writing code in c language

hello dani........

plz help to get the following output using C language(array)

using one nested for loop

*******
*****
***
*
***
*****
*******
plz...........help........quick

mishu1516
Newbie Poster
2 posts since Oct 2004
Reputation Points: 11
Solved Threads: 0
 
hplz...........help........quick

Um. To start, please read the Announcement on homework in the forums. This program is very, very easy to write, and shouldn't take too much for you to do if you just read your C programming book. Write something. Then, if you need help, post your code here, and we'll help you troubleshoot your code.

Secondly, NEVER request members of a forum to respond "quick", or quickly. Doing so implies that your problem is more important than someone else's who was here before you; therefore, it's considered to be very rude. On the forums, people are responded to in the order they posted, or when someone knows the answer.

alc6379
Cookie... That's it
Team Colleague
2,820 posts since Dec 2003
Reputation Points: 186
Solved Threads: 147
 

/**************************************************************************
**************************************************************************

A C++ Program to print a diamond in the following pattern.

*
                   * *
                  * * *
                 * * * *
                * * * * *
                 * * * *
                  * * *
                   * *
                    *

( using nested for loop ).

main()
    {
       clrscr();

       cout<<"\n ********* Diamond  *********\n"<<endl;

       int x_1=19;
       int y_1=5;

       for(int count_1=1;count_1<=5;count_1++)
	  {
	     gotoxy(x_1,y_1);

	     for(int count_2=1;count_2<=count_1;count_2++)
		cout<<"* ";

	     x_1--;
	     y_1++;

	     cout<<endl;
	  }


       int x_2=16;
       int y_2=10;

       for(int count_3=5;count_3>1;count_3--)
	  {
	     gotoxy(x_2,y_2);

	     for(int count_4=count_3;count_4>1;count_4--)
		cout<<"* ";

	     x_2++;
	     y_2++;

	     cout<<endl;
	  }
       getch();
       return 0;
    }

Now Change and Solve ur Problem

AbdullahGhunio
Newbie Poster
1 post since Aug 2007
Reputation Points: 6
Solved Threads: 0
 

Um. To start, please read the Announcement on homework in the forums. This program is very, very easy to write, and shouldn't take too much for you to do if you just read your C programming book. Write something. Then, if you need help, post your code here, and we'll help you troubleshoot your code.

Secondly, NEVER request members of a forum to respond "quick", or quickly. Doing so implies that your problem is more important than someone else's who was here before you; therefore, it's considered to be very rude. On the forums, people are responded to in the order they posted, or when someone knows the answer.


c syntax:

#include
void main()
{
int i,j,k,h;
clrscr();
for(i=0,k=0;i<7;i++,k+=2)
{
if(i==4)
k=0;
if(i<4)
for(j=6-k;j>=0;j--)
printf("*");
else
for(j=2+k;j>=0;j--)
printf("*");
printf("\n");
}
}

iam new member of this community.reply me
byeeeeeeee.

inni
Newbie Poster
1 post since Feb 2009
Reputation Points: 8
Solved Threads: 0
 

#include
main()
{

int i,n;
printf("\nEnter the no of lines:");
scanf("%d",&n);
for(i=0;i<2*n;i++)
{
for(j=i;j=n)
{
for(j=n;j

jenilgandhi
Newbie Poster
5 posts since Mar 2009
Reputation Points: 0
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You