Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q3 ) Fill in the blanks at following program that finds the areas of different geometrical shapes sue circle, square, rectangle etc using switch statements.

image text in transcribed
image text in transcribed
Q3 ) Fill in the blanks at following program that finds the areas of different geometrical shapes sue circle, square, rectangle etc using switch statements. ( 25 Pts) Winclude void main() ( int fig code; float side, base, length, breadth, height, area, radius; printf(". printf(" 1-> Circle "); printf(" 2 --> Rectangle "); printf(" 3-> Triangle "); printf(" 4 -> Square "); printf(". printf("Enter the Figure code "); scanf(".", &...); switch( .) -In"); In"); ....: printf("Enter the radius "); --("%. .", &radius); .. 3.142* radius radius; printf("Area of a circle = %. ", { case ); break; case ..: printf("Enter the breadth and length "); scanf(" &breadth, &length); = breadth * length; ... .......... -("Area of a Reactangle = %f ", area); break; .: printf("Enter the base and height "); ", &base, &.. case -); area = 0.5 * base height; printf("Area of a Triangle = %f ", ; break: case . .: printf("Enter the side "); --("%f", &. ---); area = side side; printf("Area of a Square=. break; ", In"); printf("- break; } Q4) Find 25 syntax and logic errors from given code. Write corect formas next to wng fines (The calculates power using recursion) (25 Pts) Hinclude float basepower(float n1, float n2) int main() ( int base, powerRaised, result; scanf("Enter base number: ") printf("%f",&result); printf("Enter power number(positive integer): ") printf("%f",&powerRaised); base = power(base, powerRaised); printf("%f^%f = %f", base, powerRaised, result); return 0; int power(int base, int powerRaised) else if (powerRaised = 2) return (base+power(base, powerRaised-2)); if return 1

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

More Books

Students also viewed these Databases questions