Question about Computers & Internet

1 Answer

C code i need c code to print paskal trangle

Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that gotĀ 5 achievements.

    Novelist:

    An expert who has written 50 answers of more than 400 characters.

    Governor:

    An expert whose answer gotĀ voted for 20 times.

  • Expert
  • 202 Answers

Try this Code

  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<alloc.h>
  4. void main()
  5. {
  6. int i, j,n,*p,check=1, blank, memspace, mem=0, rowdiff=1;
  7. printf("Enter the no. of rows to be printed :");
  8. scanf("%d",&n);
  9. blank=n-1;
  10. memspace=((n*(n+1))/2);
  11. p=(int*)malloc(sizeof(int)* memspace);
  12. for(i=0;i<n;i++)
  13. {
  14. printf("\n");
  15. for(j=0;j<blank;j++)
  16. printf(" ");
  17. for(j=0;j<check;j++)
  18. {
  19. if(j==0 || j==(check-1))
  20. p[mem]=1;
  21. else
  22. p[mem]=p[mem-rowdiff] + p[mem-rowdiff+1];
  23. printf("%d ",p[mem]);
  24. mem++;
  25. }
  26. for(j=0;j<blank;j++)
  27. printf(" ");
  28. blank--;
  29. check++;
  30. rowdiff++;
  31. }
  32. getch();
  33. }
--------------------------------------------------------------------------------------------------------------------------------------------------
#include<stdio.h>
void main()
{
int num,x,y,a[50][50];
clrscr();
fflush(stdin);

printf("Enter the number of rows: ");
scanf("%d",&num);

printf("\n\t\tPascal's Triangle of Order %d\n\n",num);

for(x=0;x<num;x++)
{
for(y=0;y<=x;y++)
{
if(x==y || y==0)
a[x][y]=1;
else
a[x][y]=a[x-1][y-1]+a[x-1][y];
printf("%4d",a[x][y]);
}
printf("\n\n");
}

getch();
}

Posted on Sep 21, 2008

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Whats i have to do when my dash show me service required with orange trangle


once the car has a service the workshop should reset the service indicator using an electronic scan tool via the on board diagnostic socket OBD if the light shows up before its next service is due there is a fault which needs to be diagnosed ,could be a lot of things,Airflow meter dirt , bad airtemp sensor or water temp sensor it will automatically store all errors in the DME or ecu.

Jul 31, 2016 | 2007 Mitsubishi Outlander XLS

1 Answer

The dummy manfold gasket keeps blowing out


check the matting surfaces for being flat as if they are warped it will not seal properly and blow out.

Aug 24, 2014 | Cars & Trucks

1 Answer

Tablet battery showing yellow trangle with explantion mark


it probably means it has low battery or that there's a problem charging it such as something might be messed up inside the tablet causing it to not charge.

Dec 28, 2012 | Polaroid Tablets & eReaders

1 Answer

Yellow trangle and exlamtion mark on dashboard


What car make and model is this please?Are you check your owners manual under instrument panel description?

Feb 15, 2012 | Fiat Grande Cars & Trucks

1 Answer

I have had a light come on the dash boared with an ! in a trangle and a circle around it


hi,as far as I now its to do with ur abs so it can be that one of ur sensors on the wheels is faulty or one of the wires on it is of,just have a look under car at wheels if u can see any loose wires other wise u have to get it hooked on a vag machine to read fault codes.I hope this wil help u

May 19, 2011 | 1997 Volkswagen Golf

1 Answer

Disc will not eject


due to lack of info this answer has been split into 2 anwseres.

If you are getting a yellow light this is yellow light of death call sony for repairs or look on youtbe to do yourselve.

You can hit the power on button and hit trangle while selecting the game and select eject. if these dont work comment on it.

Apr 15, 2010 | Sony Playstation 3 (PS3) Console

1 Answer

Wireless problem


if you have vista right click on my computer goto properties devise menager if any of them have this sign !!! with /_\ trangle yellow coluer right click on it search online. for any other problem email me [ ariftariq12345@gmail.com ]

Nov 18, 2009 | HP Pavilion dv4000 Notebook

1 Answer

I have a 1995 ducati 900sp and their was no owners manual with it


I wondered the same w/ my 1996 900cr. Turns out under high exceleration I was leaning forward; that meant my foot position changed on the left peg just enough to trigger the kickstand warning light.

Apr 07, 2009 | 1998 Ducati 900 SS

1 Answer

The red triangle light is on what is this


the trangle red light indicates you need to replace the toner.

Oct 17, 2008 | Sharp AL-1641CS Laser Digital Copier

1 Answer

Black berry 7290 is not working


Its mean you need to purchase new blackberry

Aug 27, 2008 | RIM BlackBerry 7290

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

92 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

kakima

Level 3 Expert

102366 Answers

David Payne
David Payne

Level 3 Expert

14161 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...