Menu

Q3 Fill Blanks Following Program Finds Areas Different Geometrical Shapes Sue Circle Squar Q43809453(1)

Q3 ) Fill in the blanks at following program that finds the areas of different geometrical shapes sue circle, square, rectangQ4) Find 25 syntax and logic errors from given code. Write corect formas next to wng fines (The calculates power using recursQ3 ) 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 <stdio.h> void main() ( int fig code; float side, base, length, breadth, height, area, radius; printf(“. printf(” 1-> Circlen”); printf(” 2 –> Rectanglen”); printf(” 3-> Trianglen”); printf(” 4 -> Squaren”); printf(“. printf(“Enter the Figure coden”); scanf(“.”, &…); switch( .) -In”); In”); ….: printf(“Enter the radiusn”); –(“%. .”, &radius); .. 3.142* radius radius; printf(“Area of a circle = %. n”, { case ); break; case ..: printf(“Enter the breadth and lengthn”); scanf(” &breadth, &length); = breadth * length; … ………. -(“Area of a Reactangle = %fn”, area); break; .: printf(“Enter the base and heightn”); “, &base, &.. case -); area = 0.5 * base height; printf(“Area of a Triangle = %fn”, ; break: case . .: printf(“Enter the siden”); –(“%f”, &. —); area = side side; printf(“Area of a Square=. break; n”, 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 <stdio> 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 Show transcribed image text 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-> Circlen”); printf(” 2 –> Rectanglen”); printf(” 3-> Trianglen”); printf(” 4 -> Squaren”); printf(“. printf(“Enter the Figure coden”); scanf(“.”, &…); switch( .) -In”); In”); ….: printf(“Enter the radiusn”); –(“%. .”, &radius); .. 3.142* radius radius; printf(“Area of a circle = %. n”, { case ); break; case ..: printf(“Enter the breadth and lengthn”); scanf(” &breadth, &length); = breadth * length; … ………. -(“Area of a Reactangle = %fn”, area); break; .: printf(“Enter the base and heightn”); “, &base, &.. case -); area = 0.5 * base height; printf(“Area of a Triangle = %fn”, ; break: case . .: printf(“Enter the siden”); –(“%f”, &. —); area = side side; printf(“Area of a Square=. break; n”, 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

Expert Answer


Answer to Q3 ) Fill in the blanks at following program that finds the areas of different geometrical shapes sue circle, square, re…

OR