Question

C language Create the following programs: Program to solve for Area of Rectangle Variable inputs for...

C language

Create the following programs:

Program to solve for Area of Rectangle

Variable inputs for length and width of integer data type

Variable output for area of integer data type

Program to find Area of Circle

variable array with 10 inputs from 3-30 by steps of 3

variable array with 10 solutions for Area of Circle of float data type

Program to solve for any angle with inputs of x and y using the standard Cartesian coordinate system

Use math.h library

Solve for output angle of float data type

Use hard coded input variables, and then use printf to output the solutions.

Homework Answers

Answer #1

#include <stdio.h>

int main() {
    int length, width;
    printf("Enter length of rectangle: ");
    scanf("%d", &length);
    printf("Enter width of rectangle: ");
    scanf("%d", &width);
    printf("Area is %d\n", length*width);
    return 0;
}

#include <stdio.h>

#define PI 3.14159

int main() {
    int radius[10] = {3, 6, 9, 12, 15, 18, 21, 24, 27, 30}, i;
    double areas[10];
    for (i = 0; i < 10; ++i) {
        areas[i] = PI * radius[i] * radius[i];
    }
    // print result
    for (i = 0; i < 10; ++i) {
        printf("Area of circle with radius %d is %lf\n", radius[i], areas[i]);
    }
    return 0;
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
USE ONLY C LANGUAGE The program should read inputs that look like this: 10 11 56...
USE ONLY C LANGUAGE The program should read inputs that look like this: 10 11 56 92 10 5 42 7 1 33 99 The program should start by reading one integer, which indicates how many numbers there are in the random sequence. The program should then read a sequence of random integers. If fewer numbers are provided than specified (by the first integer on the first line), the program should print the following error message (replace XXX with the...
In C programming, Thank you Write a program to compute the area of a circle. You...
In C programming, Thank you Write a program to compute the area of a circle. You have to write a complete ā€œCā€ program that compiles and runs in Codeblocks. Program requirements: 1. Declare the variables needed: radius (r) and area (yourLastName). 2. Calculate and print the area of each circle. 3. The program MUST prompt the user for a new radius (r) over and over until the user types -1. 5. Use the type double for all decimal numbers. 6....
C++ language 1. Programs with memory leaks a should be executed in a secure environment to...
C++ language 1. Programs with memory leaks a should be executed in a secure environment to prevent theft of data by hackers. b will eventually crash if allowed to execute for long periods of time. c should be compiled with a special compiler that detects and flags the memory leaks. d should be executed under an operating system that can dynamically plug the leaks. e none of these. 2. An  lvalue is a a value of type long. b a memory...
In C language make a structure called funds funds should have variable fields of type int...
In C language make a structure called funds funds should have variable fields of type int id; char bank[10]; float balance; The program would have a function called sum which returns a float. To sum pass structure funds and a pointer called record. initialize record to equal {1, "BOA", 10023.43} call sum passing the pointer record , the function returns a float value into variable result. initialize record to equal {2, "Chase", 4239.87} call sum passing the pointer record ,...
Please write the code in Python. Write a program/function in any Object-Oriented programming language that will...
Please write the code in Python. Write a program/function in any Object-Oriented programming language that will implement Queue Abstract Data Type with the following functions/methods.  Any build-in/pre-defined Queue function/library (e.g., java.util.Queue in Java) is NOT allowed to use in your code. push(Element):  insert the input Element (e.g., String or Integer in Java) to the end of the queue. pop(): remove the head element of the queue and print the head element on screen. count():  return the total number of elements in the queue...
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom...
Please Code in Assembly Language Code solution using the provided template AL_Template_Irvine32.asm located towards the bottom of the question.. Debug programs with Visual Studio2017/19. Please add single line or block comments explaining the purpose or functionality of your code statements. 6.) Random Strings Create a procedure that generates a random string of length L, containing all capital letters. When calling the procedure, pass the value of L in EAX, and pass a pointer to an array of byte that will...
In the following C code, Which variable if NOT of primitive data type? A. a B....
In the following C code, Which variable if NOT of primitive data type? A. a B. b C. c D. d int a = 10; double b = 20.0; float c = false; char d[5] = "Hello"; // here we define a string In programming language C, the implementation of a string data type is limited dynamic length, which means the length of a string variable is fixed once it has been defined. A. True B. False In C# programming...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g,...
For a C program hangman game: Create the function int setup_game [int setup_game ( Game *g, char wordlist[][MAX_WORD_LENGTH], int numwords)] for a C program hangman game. (The existing code for other functions and the program is below, along with what the function needs to do) What int setup_game needs to do setup_game() does exactly what the name suggests. It sets up a new game of hangman. This means that it picks a random word from the supplied wordlist array and...
c++ Program Description You are going to write a computer program/prototype to process mail packages that...
c++ Program Description You are going to write a computer program/prototype to process mail packages that are sent to different cities. For each destination city, a destination object is set up with the name of the city, the count of packages to the city and the total weight of all the packages. The destination object is updated periodically when new packages are collected. You will maintain a list of destination objects and use commands to process data in the list....
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's algorithm to ensure mutual exclusion in the respective critical sections of the two processes, and thereby eliminate the race condition. In order to implement Peterson's Algorithm, the two processes should share a boolean array calledflagwith two components and an integer variable called turn, all initialized suitably. We will create and access these shared variables using UNIX system calls relating to shared memory ā€“ shmget,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT