#include<stdio.h>
typedef struct{
float radius;
float area;
float perimeter;
float volume;
} figure;
int main()
{
// create a variable of type figure
figure x;
printf("Enter radius : ");
// get user input
scanf("%f", &x.radius);
// calculate perimeter
x.perimeter = 2.0 * 3.14 * x.radius;
// calculate area
x.area = 3.14 * x.radius * x.radius;
// calculate volume
x.volume = 4.0 * 3.14 * x.radius * x.radius * x.radius / 3.0;
printf("Radius : %f\n", x.radius);
printf("Perimeter : %f\n", x.perimeter);
printf("Area : %f\n", x.area);
printf("Volume : %f\n", x.volume);
// open file in write mode
FILE *ptr = fopen("circlePAV.txt", "w");
fprintf(ptr, "Radius : %f\n", x.radius);
fprintf(ptr, "Perimeter : %f\n", x.perimeter);
fprintf(ptr, "Area : %f\n", x.area);
fprintf(ptr, "Volume : %f\n", x.volume);
return 0;
}
Sample Output

write a c programming Write a program that will calculate the perimeter, area and volume of...
1. Write a program that determines the area and perimeter of a square. Your program should accept the appropriate measurement of the square as input from the user and display the result to the screen. Area of Square = L (squared) Perimeter of Square = 4 * L 2. Write a program that determines the area and circumference of a circle. Your program should accept the appropriate measurement of the circle as input from the user and display the result to...
In c programming
.
Part A: Writing into a Sequential File Write a C program called "Lab5A.c" to prompt the user and store 5 student records into a file called "stdInfo.txt". This "stdInfo.txt" file will also be used in the second part of this laboratory exercise The format of the file would look like this sample (excluding the first line) ID FIRSTNAME LASTNAME GPA YEAR 10 jack drell 64.5 2018 20 mina alam 92.3 2016 40 abed alie 54.0 2017...
Write a C++ program to compute the total volume of N cones, where N is a number entered by the user. Repeat the request for N until the user enters a positive number. For each cone, ask for the radius and height, compute the volume, and add that volume to the total. Each time you ask the user to enter either the height or the radius, if the user does not enter a positive number, display an error message and...
I wrote a program which computes the area and perimeter of a square, circle, or rectangle. As you will see in my main function, there is a for loop in which the user is supposed to be able repeat the program until they enter "q" to quit. However, my program runs through one time, the prompt appears again, but then it terminates before the user is allowed to respond to the prompt again. I'm not able to debug why this...
C++ programming For this assignment, write a program that will act as a geometry calculator. The program will be menu-driven and should continue to execute as long as the user wants to continue. Basic Program Logic The program should start by displaying a menu similar to the following: Geometry Calculator 1. Calculate the area of a circle 2. Calculate the area of a triangle 3. Quit Enter your choice(1-3): and get the user's choice as an integer. After the choice...
2. Write a program with three functions that will be called from the main function The functions will calculate the volume, area and perimeter of a cuboid. You should able to pass three parameters such as length, width and height, and a function will return area, another will return volume and final one will return perimeter. Define all your variables in floating point numbers 3. Modify the problem#2 to calculate the volume, area and perimeter in a sing le function...
Use
Python programming
#3 on page 47 of your python programming book: Write a Tipper program where the user enters a restaurant bill total. The program should then display two amounts: a 15% tip and a 20% tip. Name your file tipper.py Previous Next.
Java only please Write a program that displays the following menu: Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Triangle 3. Calculate the Area of a Rectangle 4. Quit Enter your choice (1-4): If the user enters 1, the program should ask for the radius of the circle and then display its area. Use the formula: area = ∏r2 Use 3.14159 for ∏. If the user enters 2 the program should ask for...
•Work in groups of two. You will write a program that will calculate the area of a square based on a randomly generated integer to be used as the side. •Person 1 –write the main function which will: 1.Generate a random integer between 1 and 100 which will be the side of the square 2.Pass that number to called functions called square_area and square_perimeter. 3.Display the side, the returned area, and the returned perimeter. •Person 2 – in a separate...
In C Programming Language, Write a simple global Typedef program. The structure has char MealName[20], char Ingredient1[10], char Ingredient2[30], float Rating, The main program references the global structure assigns values using strcpy program statement to MealName="Pasta and Meat" Ingredient1="Spaghetti" Ingredient2="Meatballs with Eggs & Bread Crumbs" Rating= 98%. Then use printf to display all values as a proper sentence on one line.