am trying to write a C program to find the percentage of marks obtained when the user enters marks scored, but the output is always coming 0.000 Please help me by telling what is the error in my code. Code: #include int main() { int totalMarks = 500; int marksScored; scanf("%d",&marksScored); float percent = (marksScored/totalMarks)*100; printf("Percent = %f",percent); return 0; }
Q: Answer properly(editable code , output screenshot) is must Write a C++ program to input…
A: Algorithm: 1.Declare main function 2.Declare variables named no_of_units to take units from the user…
Q: 1. Create a flowchart and C++ program of the following problem: The manager of a football stadium…
A: To construct above program , we have taken number of ticket sold of type premium as to be np number…
Q: C program
A:
Q: In Python Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon…
A: Step-1: StartStep-2: Declare two variable miles_per_gallon and dollors_per_gallon and take input…
Q: Write the c program that displays the water invoice price on the screen as follows, according to the…
A: Below is the required code in C language. Program Approach: Include necessary header files to get…
Q: Your task is to make a C++ program that will allow the user to input his/her grades in 5 subjects.…
A: Use an if-else ladder to find the range and print respective Grade
Q: Write a C program that calculates the price of a pizza and prints the receipt as follows: 1- Your…
A: Program approach: Create the main function. Declared all variables. Display program heading. Input…
Q: Write a C++ program that displays a table of speeds in kilometers per hour with their values…
A: Following program will convert the values from Kilometers per hour(KPH) to Miles per hour(MPH)…
Q: You are required to produce a C++ program which solves the following: 1- A worker is paid according…
A: Given that You are required to produce a C++ program which solves the following:1- A worker is paid…
Q: Write a program using C++ language that prompts the user to input an integer between 0 and 35. The…
A: Input a number. IF number < 9 ,print the no. else provide the output acc. to asked in the…
Q: Write a C program that calculates the employee salary and print the information as follows: - Your…
A: As per question the code is given below:
Q: You must implement a C++ program that calculates the position and velocity of a body thrown with an…
A: Answer :
Q: I am trying to write a C program to find the percentage of marks obtained when the user enters marks…
A: Program is absolutely right. Run it properly here i am attaching screenshot of program and output…
Q: Write a C++ program that displays a table of speeds in kilometers per hour with their values…
A: Given, The formula for converting kilometers per hour to miles per hour:…
Q: Write a c program dist.that calculates the distance between two points and prints the result on the…
A: The code is given in step 2.
Q: You are creating an application which requires the user to input the precise height of their garage…
A: In the terms of computer programming, the type conversion is referred to as a type casting way that…
Q: Suppose you designed a TAXI FARE SYSTEM and you want to evaluate the fare in according to the…
A: C++: C++ is a general purpose high level programming language. It was developed by Bjarne Stroustrup…
Q: 1. Create a flowchart and C++ program of the following problem: The manager of a football stadium…
A: #include <iostream> using namespace std; int main(){ int pr,b,s,ga;…
Q: To check whether it’s a prime number? Find its factorial? Whether it’s even or odd?
A: Actually, program is a executable software that runs on a computer.
Q: Task 3: Here is a program that computes the number of miles that light will travel in a specified…
A: Please check the step 2 for required code and step 3 for output with code screenshot.
Q: Implement a program that reads in a year and outputs the approximate value of a Ferrari 250 GTO in…
A: According to the information given:- We have to follow the table and Implement a program that reads…
Q: Write a c++ program that calculates the cost of 3 bags of fruit. The 4 possible fruits are pears…
A: i hope it will work for you #include<bits/stdc++.h>#define INF 1000000using namespace std;…
Q: Here is a program that computes the number of miles that light will travel in a specified number of…
A: Please check the step 2 for required code and step 3 for output with code screenshot.
Q: Trying to write a C# program, everytime l try and run it it fails and says they are errors.Below…
A:
Q: Write a C++ Program that calculate and print the insurance for 15 cars. For each car, the program…
A: #include <iostream>using namespace std; int main(){ int year, price; char insuranceType;…
Q: You are asked to write a C program that will accept representing the number of dollars and cents to…
A: Program when only cents are given: #include<stdio.h>void convert(int change){int i;// required…
Q: Write a C++ program that reads the information from the user to enter the name of the candidate, the…
A: Write a program for election voting system. C++ code :- #include <iostream> using namespace…
Q: (in Python) Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon…
A: Code: #function which contains the valuedef driving_cost(driven_miles, miles_per_gallon,…
Q: Write a Phyton program that computes the đuration of a projectile's flight and its height above the…
A: The program to computing the time and height, In the given formula, the sin() function is imported…
Q: 4. Write a complete C++ program to calculate the wages of employees which are based on the number of…
A: we are using do while loop here, since in do while the condition is checked after the execution of…
Q: A wholesale furniture store that sells sofas in bulk needs a program to help their cashiers. Write a…
A: We need to write a C++ language program to find the total price, delivery cost, and tax of the sofa…
Q: Hi can you please help me to continue write a program in C while loop with this problem. Problem:…
A: Summary: In this question, we have given one program, and that program is in the C language. There…
Q: You are required to produce a C++ program which solves the following: 1-A worker is paid according…
A: Code #include <iostream>using namespace std;int main(){ string name; //for input user…
Q: Write a Phyton program that computes the duration of a projectile’s flight and its height above…
A: the program is an given below:
Q: This link describes a simple gravity pendulum which consists of a point mass suspended from a string…
A: the answer is given below:
Q: Use C++ Write a program that simulates flipping a coin to make decisions. The input is how many…
A: For generating head or tail we had used rand() function. Algorithm- 1) ask number of times coin to…
Q: You have started working at a water plant and have been asked to develop a program which, can…
A: C++ program to calculate the water consumption bill for the user. Prompt the user to enter the…
Q: write a C++ program. Write a program that receives a numeric check amount, that is less than…
A: #include<iostream> #include<string> using namespace std; // This function coverts…
Q: A dice is an n-sided shape with the sides labelled by numbers 1, 2, dice used to play various games…
A: Answer : SOURCE CODE IN C++: #include <iostream> #include <fstream>…
Q: Jason Hardy opened a coffee shop at the beach and sells coffee in three sizes: small (9 oz), medium…
A: Answer :- #include <iostream> #include <iomanip> using namespace std; //constants…
Q: . In the sport of diving, seven judges award a score between 0 and 10, where each score may be a…
A: The program defines two variables: difficulty: for deciding the difficulty of each dive.…
Q: Write a C++ program in which you declare variables that will hold an hourly wage, a number of hours…
A: Program Approach: Create variables of type int Take input from user Calculate net pay using formula…
Q: Write a c program dist.that calculates the distance between two points and prints the result on the…
A: Step 1: Check whether argc is less than 7. If it is true, display error message. Step 2: Use the…
Q: Write a C program which calculates and prints the number of whole days and hours in a given number…
A: Below is the required program in C language. Program Approach: Include necessary header files to…
Q: You are required to produce a C++ program which solves the following: 1- A worker is paid according…
A: PROGRAM CODE: #include <iostream> using namespace std; float calculateTD(float income) {…
Q: Write a C++program that calculates the area of a Rectangleif the user inserts 'R' or Y, and the area…
A: #include <iostream>using namespace std; int main(){ char ch; int height , width, base;…
Q: Hi. Can you solve this question? Write a c program dist.c that calculates the distance between two…
A: #include <stdio.h>#include <math.h> int main() { float x1, y1, z1, x2, y2, z2, distance;…
Q: Can I have a flowchart for below C program code please? #include #include #include…
A: Flowchart for the provided C code is given below:
Q: I would like to create a C++ code that creates a table for the user's choice of basic math…
A: Syntax: do { // Loop-body } while ( Condition ) ; Flowchart:
I am trying to write a C program to find the percentage of marks obtained when the user enters marks scored, but the output is always coming 0.000
Please help me by telling what is the error in my code.
Code:
#include <stdio.h>
int main()
{
int totalMarks = 500;
int marksScored;
scanf("%d",&marksScored);
float percent = (marksScored/totalMarks)*100;
printf("Percent = %f",percent);
return 0;
}
Step by step
Solved in 3 steps with 1 images
- Write a c program that calculates the amount of tip per person given bill amount after tax. Atax of 16% will be added to the bill.Your program should input the following information:1. The bill2. The percentage of tip that the person wants to pay: (10%, 15%, or 20%)3. The number of personsYour program should output the following information:1. The tax amounts.2. The bill after tax3. tip per person4. Total per person(Electrical eng.) a. The voltage gain of an amplifier is given by this formula: voltagegain=[275 23 2 +0.5 f 2 ]n f is the frequency in Hz. n is the number of stages in the amplifier. Using this formula, write, compile, and run a C++ program to determine the value of the voltage gain for a four-stage amplifier operating at a frequency of 120 Hz. Your program should produce the following display: At a frequency of xxxxx hertz, the voltage gain is yyyyy Your program should replace xxxxx with the frequency and yyyyy with the voltage gain. b. Manually check the value your program produces. After verifying that your program is working correctly, modify it to determine the voltage gain of a 12-stage amplifier operating at a frequency of 9500 Hz.I need help please. This is a C++ program Design and implement a program that rolls two dice. Ask the user to input a number between 2 and 12. Then, roll your dice by using a random function to generate a random number representing one of the sides. Output the result of each die and the combined total of the two sides. Continue rolling the dice until the total equals what the user entered. Output the number of tries it took.
- Write a C program that calculates the price of a pizza and prints the receipt as follows: 1- Your program should first ask the user to enter the size of the pizza (integer value 1=large, 2=medium, 3=small) as well as the number of toppings (integer). 2- Your program should then read the pizza basic price (double) as well as the price of a topping ( float ) from the user. 3- Your program should then calculate the total price of the pizza using the following formula: Total price = ( basic price + number of toppings * topping price ) / size; And print a receipt which displays the details of your pizza order as well as the final total price to the screenConsider the simple electric circuit above. Write a C program that calculates the current through each resistor. The code must use a constant for the voltage and arrays for the resistor and current values. The program prints each current value for each resistor on a new line in the format: "I1 = x.xx", etc. Ohm's Law states: I=V/R Complete the following C program using the code provided to match the correct lines of code in the correct order to create the C program. //Line 1 //Line 2 //Line 3//Line 4//Line 5 //Line 6//Line 7//Line 8//Line9//Line 10 -//Line 1 -//Line 2 -//Line 3 -//Line 4 -//Line 5 -//Line 6 -//Line 7 -//Line 8 -//Line 9 -//Line 10 1. #include <stdio.h> 2. printf("I%d = %.2f\n", i+1, currArray[i]); 3. void main(char argc, char **argv) 4. currArray[i] = (float)VOLTAGE/resistArray[i]; 5. float currArray[4], resistArray[4] = {10, 20, 30, 40}; 6. for (int i = 0; i < 4; i++) ; 7. int currArray[4], resistArray[4] = {10, 20, 30, 40}; 8. while…Write a C++ program that calculates the Volume of a Triangular Prism. The main function asks the user to input a (i.e., length of the triangular prism), b(i.e., base length of the triangular prism), and h(i.e., the height of the triangular prism. Then the main function calls another function to calculate the volume of that triangle prism. Finally, the main function displays the volume of the triangle prism. Recall that Volume of a Triangular Prism =1/2 abh
- Write a C++ program that calculates the average of a group of test scores, where the lowest score in the group is dropped. It should use the following functions: void getScore() should ask the user for a test score, store it in a reference param- eter variable, and validate it. This function should be called by main once for each of the five scores to be entered. void calcAverage() should calculate and display the average of the four highest scores. This function should be called just once by main and should be passed the five scores. int findLowest() should find and return the lowest of the five scores passed to it. It should be called by calcAverage, which uses the function to determine which of the five scores to drop. **DO NOT USE AN ARRAY OR GLOBAL VARIABLES!!!*** YOU MUST USE THE STATED FUNCTIONS. AND INPUT VALIDATION. For FULL CREDIT DISPLAY THE LOWEST SCORE WITH GOOD OUTPUT DESCRIPTION you MUST USE function prototyping.. DO NOT ACCEPT SCORES LESS THAN 0 OR GREATER THAN…C++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter: a. The total number of of units. b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit. d. Amount to maintain a rented unit. The program then outputs the number of units to be rented to maximize the profit.Trying to write a C# program, everytime l try and run it it fails and says they are errors.Below screenshot is for the problem Write a program to calculate electricity charges for a customer. The program requests a name, previous meter reading and current meter reading. The difference in the two readings gives the number of units of electricity used. The customer pays a fixed charge of $25. In addition to the fixed charge, 20 cents is charged for each unit used. Print all the data, the number of units used and the amount the customer must pay, appropriately labelled. Additional information: You may assume that the current meter reading is larger than or equat to the previous meter reading. You may assume all data entered into your program is correct
- Need help with a C++ program Write a C++ program that helps a person determine how long they can hike for under various conditions on a given supply of water. Your program should prompt the user to enter how much water they can carry in liters. Then, for each of the following conditions, print out how many hours the user can hike for. - moderate temperature, moderate difficulty: 1/2 liter per hour- moderate temperature, high difficulty: 3/4 liter per hour- high temperature, moderate difficulty: 1 and 1/2 liters per hour- high temperature, high difficulty: 1 and 3/4 liters per hour SAMPLE OUTPUT Hello! Welcome to the Hiking Water Calculator!How many liters of water can you carry? 8 OK. Here is how long you can hike for on 8 liters of water under the following conditions: moderate temperature, moderate difficulty: 16 hoursmoderate temperature, high difficulty: 10.6666666 hourshigh temperature, moderate difficulty: 5.3333333 hourshigh temperature, high difficulty: 4.5714285 hours.…Use python of this excerxises. A company selling household appliances gives commissions to its salesmandetermined by the kind of product sold as well as the sales amount. Type 1: 7% of sale or 400, whichever is more. Type 2: 10% of sale or 900, whichever is less. Type 3: 12% of sale. Type 4: P250, regardless of sale price. Make a flowchart and a C program that would input the KIND of appliancesold (between 1-4) and the sale PRICE and output the Commission that thesalesman will receiveWrite a C program that reads a double value (x) from the user and then uses it to compute the value of the mathematical constant e to the power of x (ex) and print it in main using the following infinite series: ex =1+x/1!+x2/2!+x3/3!+x4/4!+... Your program should include the following three functions: 1- function called powerOfNumber which takes two parameters: x (double) and y (integer) and returns the value of xy . Function PowerOfNumber MUST use a while loop. ( Not allowed to use the predefined function pow in math.h). 2- function called factorialOfNumber which takes one parameter x (integer) and returns its factorial. Function factoriaOfNumberl MUST use a for loop. 3- function called computeExpo which receives one parameter x (double) and returns the value of ex for the given x using the series above as well as functions powerOfNumber and factorialOfNumber ( 1 and 2 above) . Function computer_ex MUST use a do/while loop. The loop should stop 1 when the new term…