Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose: Write two small programs (1)A C program that computes e the ratio of the crcumference of any cirdle to the diameter of that circle,

image text in transcribed
image text in transcribed
Purpose: Write two small programs (1)A C program that computes e the ratio of the crcumference of any cirdle to the diameter of that circle, and outputs it. (2) A C program that pints a pyramid Getting started Create a new directory called lab06 under your cse220 directory mplement the programs below in your labo6 directory Description of two projects 1. 7T The number ris a mathematical constant approximated at 334 A formula for computing it is as follows 2k +1 Write a program called pic that approximates the value of aby using the folowing equation 2k +1 wheren is a number entered by the user. Your program will first compute as 40 6-3/3) then as4-Y-)3, then as 4-1/1 13 -1l/S) and so on For debugging purpose, in each step, print the step number and the value of eso far, as follows (with &digts after the decimal point) 0 4.00000000 2 346666666 Later for submission, the above is replaced by 0, 10000, 20000, and so on, because we use EPOCH 10000 below. As I taught, we should not use any "magic numbers in our programs to facilitate bug-free software maintenance. /a0c" here means hard to understand by others without a name Use double (not float) to store the value of pi. Update your program so the output is printed every EPOCH-10000 teration. How many iterations (up to precision in EPOCH-10000's) does your pregam take for the value to pi to converge within 30 eror ie, to stop changing the estimated value even f you increase the user-given output nj? Only when you are ready, use typesoript from the script command to report the computer session that computes e at the required precision 10. Do not print any information not required so that your typescript fie is about a single page long. Note Wuing math.h, you need to link the math Ebrary when compiling your program using the gc 2. Pyramid Write a program pyramid.c that reads an integer from the user and outputs the following pattern where the number of stars at the bottom is equal to the number read. You must use a nested loop. Your program should check if the number given by the user is odd or even. If it is even, the program should display an error message and exit. Otherwise, it should continue and display the pyramid. Submission Submit the following files through Google Classroom pi.c, typescript, pyramid.c Use only these file name! Do not upload any other files. These files can be submitted through the browser within X2Go. Remember to submit your files prior to the deadline as you won't be able to submit if the deadline has passed. You should always verify that you submitted the correct file. As stated in the syllabus, late work will not be accepted

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions