Question

To figure out the spacing for each line, think about how many characters each line occupies. Then analyze how that character number relates to the row number. 12. filename: pascal.c (use pascal.out to test your solution) The values of the Combinations function used in the text are of

0 0
Add a comment Improve this question Transcribed image text
Answer #1

5./main #include <stdio.h> int main() { int rows = 8; int i, j, ss = rows; 1 1 1 2 1 1 3 3 1 1 4 6 4 1 5 10 10 5 6 15 20 15 7



#include <stdio.h>

int main() {

int rows = 8;

int i, j, ss = rows;

for(i = 0; i < rows; ++i, ss--) { // looping 8 times

int current = 1, a = i, b = 1;

for(j=0; j<ss; j++) // printing spaces

printf(" ");

for(j = 0; j <= i; ++j, --a, ++b) { // printing each number

printf("%3d ", current);

current *= a;

current /= b;

}

printf("\n"); // printing a line

}

return 0;

}

// Please up vote. Happy Learning!

Add a comment
Know the answer?
Add Answer to:
To figure out the spacing for each line, think about how many characters each line occupies....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Calculate the probability of the following events:

    Calculate the probability of the following events: C = the sum of the digits is less than or equal to 6 D = the sum of the digits is greater than or equal to 7 P(C) P(D) P(C or D) P(C and D) 2 Dice Sample Space 1,11,21,31,41,51,62,12,22,32,42,52,63,13,23,33,43,53,64,14,24,34,44,54,65,15,25,35,45,55,66,16,26,36,46,56,6

  • Consider the following binary relations R1, R2, and R3 below, each defined over the set of...

    Consider the following binary relations R1, R2, and R3 below, each defined over the set of integers between 0 and 4 inclusive and with each tuple (a,b) indicating that a is related to b. R1 = {(0,0), (0,3), (1, 1), (1, 2), (2,0), (2,3), (3, 1), (3,4), (4,0), (4,1)} R2 = {(1, 2), (2, 2), (3,0), (3,2), (4,0), (4,3)} R3 = {(0,0), (1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4,4)} Which of these three relations is an...

  • A single​ 6-sided die is rolled twice. The set of 36 equally likely outcomes is​ {(1,1),...

    A single​ 6-sided die is rolled twice. The set of 36 equally likely outcomes is​ {(1,1), (1,2),​ (1,3), (1,4), left parenthesis 1 comma 5 right parenthesis comma(1,5), left parenthesis 1 comma 6 right parenthesis comma(1,6),left parenthesis 2 comma 1 right parenthesis comma(2,1),left parenthesis 2 comma 2 right parenthesis comma(2,2),​(2,3), (2,4),​ (2,5), (2,6),​ (3,1), (3,2),​ (3,3), (3,4),​ (3,5), (3,6),​ (4,1), (4,2),​ (4,3),left parenthesis 4 comma 4 right parenthesis comma(4,4),left parenthesis 4 comma 5 right parenthesis comma(4,5),left parenthesis 4 comma 6 right...

  • How would you use this stored procedure to change the price of any copy of book 0180 whose format...

    How would you use this stored procedure to change the price of any copy of book 0180 whose format is paperback to $10.95? using MYSQL 8.0 Command line Client This is the database script for the homework above CREATE DATABASE HENRY; USE HENRY; CREATE TABLE AUTHOR (AUTHOR_NUM DECIMAL(2,0) PRIMARY KEY, AUTHOR_LAST CHAR(12), AUTHOR_FIRST CHAR(10) ); CREATE TABLE BOOK (BOOK_CODE CHAR(4) PRIMARY KEY, TITLE CHAR(40), PUBLISHER_CODE CHAR(3), TYPE CHAR(3), PRICE DECIMAL(4,2), PAPERBACK CHAR(1) ); CREATE TABLE BRANCH (BRANCH_NUM DECIMAL(2,0) PRIMARY KEY,...

  • SQL includes many numerical functions. Two of these functions are FLOOR and CEIL. Use the Internet...

    SQL includes many numerical functions. Two of these functions are FLOOR and CEIL. Use the Internet to research these functions. Are the functions available in Oracle, SQL Server, and Access? Write a paragraph that discusses what the functions do and any differences and/or similarities between the functions in Oracle, SQL Server, and Access. Then perform the following tasks: Solmaris Condominium Group would like to know the impact of discounting its condo fees by 3 percent. Write an SQL statement in...

  • please complete the missing function only to figure out how many numbers fall within the range...

    please complete the missing function only to figure out how many numbers fall within the range of 90 through 99 total of 29 values in C 6 finclude "lab5.h" 8 const char *FILENAME() - / array of the data file names * ("lab5a.dat", "lab5b.dat", NULL); 12 int main(void) 13 int file count = 0; keeps track of which file we are on/ int check overflow - 0; / counter to prevent array overflow int real filesize = 0; /actual count...

  • #1 What is the slope of the line containing the points (-1,4) and (3,2)

    #1 What is the slope of the line containing the points (-1,4) and (3,2)? a. -2 b. 1/2 c. -1/2 d. 2 -------------------------------------------------------------------------------- Question 2 (Multiple Choice Worth 1 points) Choose the best description for graphing the point (3,-4). a. Go to the left three and up four. b. Go to the right three and up four. c. Go to the right three and down four. d. Go to the left three and down four. -------------------------------------------------------------------------------- Question 3 (Multiple Choice...

  • Apple Inc. CONSOLIDATED STATEMENTS OF OPERATIONS (In millions, except number of shares which are reflected in...

    Apple Inc. CONSOLIDATED STATEMENTS OF OPERATIONS (In millions, except number of shares which are reflected in thousands and per share amounts) September 28, 2019 Years ended September 29, 2018 September 30, 2017 Net sales: Products $ $ $ Services 2 1 3,8 8 3 46,291 260,1 74 2 2 5,8 4 7 39,7 48 2 6 5,5 95 1 96,5 34 32,700 2 2 9,2 3 4 Total net sales Cost of sales: Products Services Total cost of sales 1.4.4,996...

  • Database HW help!!!!!!! Provide the SQL statements for the following queries. (1) Provide the names and...

    Database HW help!!!!!!! Provide the SQL statements for the following queries. (1) Provide the names and phones of all swimmers currently in level (of id) 3. +-------+---------+---------------------------+ | FName | LName   | EMail                     | +-------+---------+---------------------------+ | Bobby | Khan    | theBKhan1 | | Clara | Johnson | ClaraJohnson_11 | +-------+---------+---------------------------+ 2 rows in set (0.00 sec) (2) Provide the names of swimmers who have signed up to participate in the event '100M Butterfly' of Meet id 1. +-------+---------+ | FName...

  • please answer these queries. 1. List the artist name of the artists who do not have...

    please answer these queries. 1. List the artist name of the artists who do not have a webaddress and their leadsource is “Directmail” 2. List the names of members in the artist called 'Today'. 3. Report the total runtime in minutes FOR EACH album in the Titles table. 4.List the firstname, lastname of members who are represented by the salesperson “Lisa Williams” 5.List EACH salesperson’s firstname along with the number of Members that EACH SalesPerson represents. DROP TABLES IF EXISTS...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT