Question
Write a C program that defines the length and breadth of a rectangle and calculates its area and perimeter. Area = Length * Breadth, Perimeter
Write a C program that defines the length and breadth of a rectangle and calculates its area and perimeter. Area = Length * Breadth, Perimeter = 2 * (Length + Breadth) a) Define a variable called "length", and sets its value to 10 b) Define a variable called "breadth", and sets its value to 5 c) Compute the area of the rectangle, and store it in a variable called "area" d) Compute the perimeter of the rectangle, and store it in a variable called "perimeter". e) Print the area and perimeter of your rectangle using the following printf statement: printf("Area = %d; Perimeter = %d", area, perimeter);
Then
Write a C program to take an integer input from the user (using scanf) and print the integer entered by the user in decimal, octal and hexadecimal format. Example Output 1: Enter an integer: 20 User Entered(decimal): 20 User Entered(octal): 24 User Entered(hexadecimal): 14 Example Output 2: Enter an integer: 500 User Entered(decimal): 500 User Entered(octal): 764 User Entered(hexadecimal): 1f4 Note: In this case, when asked/prompted to enter an integer, the user entered 20 and 500 respectively.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started