EGN3211-HW5.pdf | file:///C:/Users/malik/Downloads/EGN3211-HW5.pdf - Chapter 6.
ID: 674222 • Letter: E
Question
EGN3211-HW5.pdf | file:///C:/Users/malik/Downloads/EGN3211-HW5.pdf - Chapter 6. 2. Identify and correct the errors, if there are any, in the following program segments. Briefly explain why (a) int fune (double a) int func (int a} { return 10 ; (b) int funcint a) { return 2+a: func [2, 3) (c) void func1(int a); int funcl (int a) int ba return b: (d) void func1int a} { (e) double sun(doubl , double b} return atb void func (double a, double b) t ouble sumi B. Calculate the values of the following function using a C function at x=3.5. 15. Write a program that calculates the area and perimeter of a rectangle. The area and perimeter are calculated using two separate functions, which both take two arguments of double type for width and length of the rectangle. Calculate the area and perimeter using these two functions in the main program for a rectangle with width and ength of 2 cm and 5.5 cm, respectively 18. Write a C program that uses the function rand() to generate an integer randomly in the range of 1 to 50. The random number generated by the program shall be different at each run. The program then prompts the user to s the number by displayin g the following messages: have a number betveen 1-50 Can you guess rhat it is? Enter your initial guess After the user's initial guess, the program 1) Correct! That the number Vould you like to play again (y or n) ? 2) Too lo. Guess again 3) Too high. Guess again The program should loop until the user guesses the correct answer. Use the Too low and Too high m should display one of the following responses: to help the user guess the number. Once th he she would like to play again. Describe your algorithm in procedures, pseudocode, and fowchart. (Note: write a function called guessGame ) to play this guessing game.) e user guesses the right number, th e program should ask whether Page 3 11:04 AM 4) 10/22/2015 | Search the web and WindowsExplanation / Answer
chapter5 3(a) no error this code but declare header file and main functon
3(b) total=0
4:total 385
9)#include<stdio.h>
main(0
{
int i,j,k,n;
printf("enter value");
scaf("%d",&n);
j=2;
for(i=1;i<n;i++)
pritf("%d*%d=%d",i,j,j*i);
k=20;
for(i=1;i<n;i++)
printf("%d*%d=%d",i,k,i*k);
printf("/n);
m=200;
for(i=1;i<n;i++)
printf("%d*%d=%d",m,i,m*i);
prntf("/n");
}
25:
chapter8:
1)intx and void function can use dfor variable declaration
3:out put of the program when it is excuted f(5) and f(15) also give 1.4899.
In computer programming, a function prototype or function interface is a declaration of a function that specifies the function's name and type signature (arity, parameter types, and return type), but omits thefunction body
program:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.