answersLogoWhite

0

int factorial (int n)

{

if (n==0) return 1;

else return (n*factorial(n-1));

}

int combo (int n, int r)

{

return (factorial (n))/(factorial (r) * (factorial (n-r)));

}

int width(int n, int i, int j)

{

return(j==0?(((n+1)*2)-((i==0)?i:(i-j))):(j<=3)?j+1:j-1);

}

void print (int n)

{

int i, j;

for (i = 0; i<=n; ++i)

{

for (j = 0; j<=i; ++j)

{

printf ("%*d", width(n,i,j) ,combo (i, j));

if (i==j)

{

printf("\n");

}

}

}

}

int main ()

{

int row,col;

int maxrow;

printf("\nPlease enter the num of rows for pascal triangle : ");

scanf("%d",&maxrow);

printf("The Pascal Triangle for %d rows is :\n",maxrow);

print(maxrow);

printf("To get the value at any row, col please enter \nRow:");

scanf("%d",&row);

printf("Col:");

scanf("%d",&col);

printf("\nThe value at row %d & col %d is : %d\n",row,col,combo(row,col));

}

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

How can you create a loop using a knot?

To create a loop using a knot, you can make a simple overhand knot in a rope or string and leave a small loop at the end. This loop can be used for various purposes such as attaching a hook or securing an object.


How can I create a seamless loop in After Effects?

To create a seamless loop in After Effects, you can duplicate your footage, offset the timing of the duplicate, and blend the two together using keyframe animation. This will create a continuous loop without any noticeable breaks or jumps.


How can I use the ffmpeg loop feature to create a continuous video loop?

To create a continuous video loop using the ffmpeg loop feature, you can use the &quot;loop&quot; option in the ffmpeg command followed by the number of times you want the video to loop. For example, you can use the command &quot;ffmpeg -streamloop -1 -i input.mp4 output.mp4&quot; to loop the video indefinitely.


How do you create a textured fabric using the single crochet stitch in back loop only?

To create a textured fabric using the single crochet stitch in the back loop only, you work the stitch by inserting the hook into the back loop of the stitch from the previous row. This technique creates ridges and a bumpy texture on the fabric.


How do you create a ribbed texture in your crochet project using the single crochet back loop only technique?

To create a ribbed texture in your crochet project using the single crochet back loop only technique, you work only in the back loop of each stitch. This creates a raised ridge effect that gives the project a ribbed appearance.


How can you create a more efficient code structure by utilizing the keyword variable loop?

By using the keyword &quot;variable&quot; in a loop, you can create a more efficient code structure by dynamically adjusting the loop based on changing variables, which can help streamline the execution of the code and make it more adaptable to different scenarios.


How do you create this shape using the for loop in c?

There is insufficient information in the question to answer it. You did not specify what "this shape" was. Please restate the question.


How can I create a loop clip in Premiere?

To create a loop clip in Premiere, you can use the &quot;Time Remapping&quot; feature to set keyframes at the beginning and end of the clip, then adjust the speed to create a seamless loop.


How can I create a drum loop in GarageBand?

To create a drum loop in GarageBand, first open the software and select the Drummer track. Choose a drummer and adjust the style and complexity of the drum loop. You can also customize the drum sounds and patterns to create your desired loop.


How do you create a loop (for loop, while loop) in Python?

In Python, you can create loops using different constructs, such as the for loop and the while loop. These loops allow you to repeatedly execute a block of code until a specific condition is met. Here's how you can create loops in Python: for loop: A for loop is used when you want to iterate over a sequence of elements such as a list, tuple, or string. It executes a block of code for each item in the sequence. for item in sequence: # Code block to be executed Here's an example that prints the numbers from 1 to 5 using a for loop: for num in range(1, 6): print(num) 2 while loop: A while loop is used when you want to repeat a block of code as long as a certain condition is true. It keeps executing the code block until the condition becomes false. while condition: # Code block to be executed Here's an example that prints the numbers from 1 to 5 using a while loop: num = 1 while num


How does loop work?

In programming, a loop works by conditionally jumping to the start of the loop and repeating the instructions. If the condition evaluates false, execution continues to the next instruction, thus breaking out of the loop. We can also break out of a loop from within the body of the loop itself using another conditional jump which jumps out of the loop. If we jump backwards out of a loop we effectively create an intertwined loop, known as spaghetti code which is difficult to read and maintain. Structured loops help make it easier to digest the logic. In C, a jump is achieved using a goto and a label. However, structured loops using for, while and do-while statements make loops much easier to read and maintain.


What is the time complexity of using a while loop inside a for loop?

The time complexity of using a while loop inside a for loop is O(nm), where n is the number of iterations of the for loop and m is the number of iterations of the while loop.