
thumbs up ONLY for correct answer.
thank you.
Hi,
I am using C to implement the above psuedo code since it is widely used and easy to understand.
#include <stdio.h>
int main()
{
float n;
float s=0;
float x;
float c=0;
printf("Input n \n");
scanf("%f", &n);
for(int i =1; i<=1000; i++){
for(int j=1; j<=n; j++){
x = 0.5;
s = s+x;
}
if((s/n>0.45)&&(s/n<0.55)){
c = c+1;
s=0;
}
}
float a = c/1000;
printf("%f",a);
return 0;
}
Or we can use
#include <stdio.h>
#include<stdlib.h>
int main()
{
float n;
float s=0;
float x;
float c=0;
printf("Input n \n");
scanf("%f", &n);
for(int i =1; i<=1000; i++){
for(int j=1; j<=n; j++){
x = (((float) rand() / RAND_MAX) * 0.10) + 0.45; //generating
random decimal between 0.45 and 0.55
s = s+x;
}
if((s/n>0.45)&&(s/n<0.55)){
c = c+1;
s=0;
}
}
float a = c/1000;
printf("%f",a);
return 0;
}
Find attached the screen shots of different outputs with 3
different values of n. n=100, n=25, n=1

I hope this will
help!!!!!!
Thanks!!!
thumbs up ONLY for correct answer. thank you. Adapt the code and run it (in the...
Please answer and explain thank you. Question 1 What will be printed when the following code is executed? double x = 45678.259; System.out.printf("%,.2f", x); Group of answer choices 45678.259 0,045,678.26 45,678.26 45,678.3 Question 2 What will be printed when the following code is executed? double x = 45678.259; String output = String.format("%,.1f", x); System.out.println(output); Group of answer choices 45678.259 45,678.259 45,678.26 45,678.3 Question 3 What will be the value of ans after the following code has been executed? int ans=0;...
phase dtransformation diagram and heat
treatment.
Can you answer parts a b and c please. need it done in
the next 30 mins
1: Using the phase transformation diagram below, describe heat treatment procedures to produce the following from eutectoid steel at 750°C 800 1400 А Eutectoid temperature 700 A 1200 P 600 1000 N 500 -- Temperature (°C) Temperature (°F) @ B 800 400 A 600 300 50% 400 200 100 104 10-1 105 1 103 10 102 Time...
Please answer the exercise 9.2. I have included the spectrums.
Please review attached images and table to help answer questions.
Match the compounds to their corresponding spectrums. Thank you
very much!
Match each spectrum in exercise 9.2 of your text (pages 449-450) to a compound on the right. Remember that you can use Table 9.2 on page 439 to solve these puzzles along with some of the reading. cycloheptene H2N 4-methylaniline CI p-dichlorobenzene ethynylbenzene 3-methylphenol odobenzene Choose... Exercise 9.2 spectrum...
PLEASE ANSWER QUICKLY!! I WILL THUMBS UP! Thank you so much in
advance!!
Neatly sketch the complete heat-pump cycle from Question 1 on a P-h diagram, showing clearly all six processes (1) - (2) - (3) - (4) - (5) - (6)-(1). If you have a printer available, you may print this PDF file of the R134a P-h diagram. Otherwise, draw a very neat scale copy of the P-h diagram shown below. You do not have to type any response...
BELOW CODE DONE IN CODIO AND PASSED THE FIRST SET OF CHECKS FOR COLLECT CUSTOMER DATA PART 2 (CODIO) CHECK INSTRUCTIONS BELOW - PASSED Collect Customer Data - Part 2 Collect Mileage information: Prompt: "Starting Odometer Reading:\n" Variable: odoStart = ? Prompt: "Ending Odometer Reading:\n" Variable: odoEnd = ? Add code to PRINT odoStart and odoEnd variables as well as the totalMiles to check your work. The following data will be used as input in the test: odoStart = 1234...
NMR
IR
CAN YOU PLEASE ANSWER AS SOON AS POSSIBLE THANK
YOU
PLEASE EXPLAIN IT IN DETAIL THANK YOU
Experimental Data Only report the IR absorptions that provide diagnosis for the major functional groups. Copies of your spectra will be included in your lab report with this information written on the spectra. However, the information should also be included in the body of the report in a text format similar to the example given below IR cm1: 1735 (C-o); MS:...
Please Update my C++ code: Implement array to replace for vector: Example --> input: 100 output: A 1000Pairs.txt looks like this: {100, A } {200, A } {300, B } {400, C } {500, D } {600, E } {700, F } {800, G } {900, H } {1000, I } {1100, J } {1200, K } {1300, L } {1400, M } {1500, N } {1600, O } {1700, P } {1800, Q } {1900, R } {2000, S...
Assignment Predator / Prey Objectives Reading from and writing to text files Implementing mathematical formulas in C++ Implementing classes Using vectors Using command line arguments Modifying previously written code Tasks For this project, you will implement a simulation for predicting the future populations for a group of animals that we’ll call prey and their predators. Given the rate at which prey births exceed natural deaths, the rate of predation, the rate at which predator deaths exceeds births without a food...
please answer all thank you
Homework - State Loading Advanced (Part 2) A solid round 20 mm diameter hur is based as shown below, where the lead iP XOAN, the downward tr adise.SSAN, the lig h the is M-20 Nm, and the true lead is T-30 Nm. This results in certain stresses in the bar the base al Points located at the top of the har d ew from (located ISO w from 4-y il Decated 270cw from located in...
This is the sequence 1,3,6,10,15 the pattern is addin 1 more than last time but what is the name for this patternThese are called the triangular numbers The sequence is 1 3=1+2 6=1+2+3 10=1+2+3+4 15=1+2+3+4+5 You can also observe this pattern x _________ x xx __________ x xx xxx __________ x xx xxx xxxx to see why they're called triangular numbers. I think the Pythagoreans (around 700 B.C.E.) were the ones who gave them this name. I do know the...