Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have this code, and I can't figure out how to fix these errors. help! the question is this: Write a C program to show

I have this code, and I can't figure out how to fix these errors. help!

the question is this: Write a C program to show how many out of 500 are between 50 and 150.0; and store those numbers in a new array B.

and the errors I'm getting are: main.c:

In function 'main': error: expected expression before 'if' 84 | if (array[i]> 50 && array[1]

expected expression before '}' token 86 | printf ("The numbers between 50 and 150 is: Xi ", cnt); return 0;} ******************************************************************************************** #include

int main()

{

float array[500] ={133.077, 353.171, 272.317, 9.84711, 100.156, 468.909, 127.629, 1.25313, 331.166, 12.4806, 47.1308, 459.066, 222.106, 320.366, 447.939, 315.992, 368.533, 488.7, 316.918, 201.467, 61.2842, 356.199, 131.416, 110.222, 428.207, 4.02826, 359.1, 101.375, 329.052, 35.1193, 232.471, 101.122, 497.885, 23.6387, 186.34, 142.056, 276.78, 203.273, 238.401, 326.064, 408.247, 214.573, 421.483, 125.597, 347.963, 358.374, 291.067, 16.3751, 419.756, 355.345, 431.967, 415., 91.7042, 321.226, 200.497, 314.879, 93.8189, 298.587, 15.1569, 173.822, 317.039, 96.3144, 276.756, 347.759, 408.792, 381.742, 355.273, 223.162, 61.8293, 24.3681, 65.2061, 207.787, 142.073, 169.023, 133.239, 292.786, 51.3692, 347.797, 432.742, 477.908, 457.55, 50.2092, 418.585, 305.085, 141.511, 453.895, 142.829, 457.327, 232.719, 73.1532, 287.556, 235.165, 171.89, 49.7851, 223.35, 28.3785, 30.8162, 380.762, 91.111, 235.592, 479.447, 33.9658, 158.369, 257.684, 22.8966, 483.757, 239.784, 452.599, 381.386, 30.8617, 97.9551, 495.273, 149.667, 457.709, 310.399, 261.108, 477.777, 408.923, 88.0496, 233.729, 447.961, 29.1611, 496.939, 498.137, 468.514, 495.195, 339.569, 241.452, 446.617, 12.4387, 100.785, 288.853, 66.2314, 481.577, 3.83027, 293.581, 416.565, 24.8685, 193.431, 33.4731, 438.788, 115.945, 106.381, 299.744, 490.828, 87.784, 109.443, 301.607, 23.314, 92.5887, 269.873, 61.155, 76.6971, 81.15, 170.088, 272.302, 11.4657, 99.5729, 167.258, 478.721, 94.9008, 75.7044, 473.827, 446.248, 156.113, 459.759, 368.445, 147.504,165.285, 372.975, 260.003, 345.897, 142.971, 281.387, 490.129, 285.742, 67.274, 201.237, 321.041, 14.4398, 56.8083, 102.664, 154.783, 35.7185, 461.908, 27.9593, 180.957, 89.4704, 306.795, 68.1999, 312.511, 441.966, 142.51, 195.225, 53.5086, 97.0697, 499.538, 413.838, 63.3795, 311.328, 433.264, 213.601, 242.338, 297.888, 377.456, 111.938, 88.5552, 263.17, 415.549, 84.9783, 407.599, 174.699, 109.754, 17.7784, 96.0876, 232.733, 467.244, 322.554, 43.579, 136.663, 467.706, 408.716, 480.199, 325.335, 35.4412, 196.114, 238.861, 28.4469, 157.985, 85.1769, 151.306, 265.277, 242.437, 1.19858, 243.707, 91.5778, 133.683, 483.42, 148.619, 358.845, 166.439, 161.866, 106.04, 223.182, 198.733, 253.151, 125.841, 397.846, 164.292, 58.0362, 386.98, 370.4, 7.30672, 472.859, 236.674, 106.122, 264.87, 472.661, 492.967, 15.5447, 132.187, 489.24, 345.348, 156.7, 465.749, 328.374, 240.307, 433.518, 268.016, 76.2234, 115.466, 36.6719, 104.724, 19.1872, 228.486, 166.272, 98.4171, 46.328, 491.812, 61.1499, 333.547, 73.6673, 498.844, 46.6052, 202.36, 84.4268, 154.496, 389.905, 236.611, 256.053, 414.189, 456.387, 468.595, 180.829, 299.723, 420.715, 364.871, 162.642, 72.2363, 255.443, 267.454, 117.314, 80.4245, 195.293, 433.907, 44.6469, 81.58, 149.688, 232.548, 460.22, 427.084, 259.782, 495.937, 205.167, 13.8946, 303.395, 28.3416, 25.3379, 214.172, 382.68, 163.47, 362.696, 142.936, 128.237, 396.016, 246.382, 63.5113, 432.945, 462.109, 202.735, 481.931, 284.257, 230.561, 242.515, 55.8477, 25.4743, 234.624, 38.3473, 42.9531, 222.079, 207.283, 14.0094, 328.781, 339.399, 44.8123, 151.314, 186.845, 212.161, 148.796, 404.932, 124.334, 279.217, 186.688, 203.197, 142.403, 494.96, 456.127, 460.683, 87.5551, 470.486, 222.503, 423.336, 45.602, 249.407, 16.22, 410.326, 216.821, 410.008, 471.408, 260.013, 30.9757, 198.847, 323.611, 355.081, 406.642, 419.63, 137.924, 152.883, 265.239, 424.67, 181.797, 192.2, 178.684, 454.185, 459.295, 268.865, 134.082, 205.778, 444.075, 358.539, 417.261, 295.77, 472.667, 99.5259, 387.285, 97.9232, 150.056, 244.445, 480.643, 178.293, 13.1318, 92.5622, 216.404, 253.623, 331.335, 400.362, 38.7207, 299.438, 372.04, 132.497, 404.639, 94.6604, 427.966, 273.959, 487.378, 298.89, 455.299, 175.433, 101.093, 201.967, 306.243, 430.987, 120.45, 24.6742, 294.111, 339.425, 404.045, 271.051, 462.777, 439.063, 366.325, 471.613, 91.7363, 307.566, 461.686, 377.953, 163.771, 34.6073, 474.307, 80.0622, 208.472, 359.175, 374.214, 378.095, 402.229, 428.187, 254.764, 354.421, 109.117, 89.762, 350.719, 84.3694, 146.341, 150.699, 484.394, 112.756, 55.6046, 343.133, 23.7084, 234.804, 391.834, 309.526, 49.4009, 155.742, 184.362, 450.351, 175.187, 277.647, 282.133, 23.1639, 420.422, 423.226, 174.016, 433.402, 70.7036, 339.857, 28.6748, 283.703, 86.3095, 228.1, 473.07, 440.57, 63.6011, 493.296, 82.2363, 132.045, 15.2001, 338.555, 397.874, 181.694, 340.013, 61.9079, 116.741, 159.53, 419.591, 138.682, 442.725, 226.128, 349.887, 298.825};

int cnt = 0;

int i = 0;

- for (i

i++;

if (array[i] >= 50 && array[i]

cnt++;

printf("The numbers between 50 and 150 is: %1 ", cnt);

return 0;

}

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

257.684,22.8966,483.757,239.784,452.599,381.386,30.8617,97.9551,495.273,149.667,457.709,310.399,261.108,477.777,408.923,88.0496,233.729,447.961,29.1611,496.939,498.137,468.514,495.195,339.569,241.452,446.617,12.4387,100.785,288.853,66.2314,481.577,3.83027,293.581,416.565,24.8685,193.431,33.4731,438.788,115.945,106.381,299.744,490.828,87.784,109.443,301.607,23.314,92.5887,269.873,61.155,76.6971,81.15,170.088,272.302,11.4657,99.5729,167.258,478.721,94.9008,75.7044,473.827,446.248,156.113,459.759,368.445,147.504,165.285,372.975,260.003,345.897,142.971,281.387,490.129,285.742,67.274,201.237,321.041,14.4398,56.8083,102.664,154.783,35.7185,461.908,27.9593,180.957,89.4704,306.795,68.199,312.511,441.966,142.51,195.225,53.5086,97.0697,499.538,413.838,63.3795,311.328,433.264,213.601,242.338,297.888,377.456,111.938,88.5552,263.17,415.549,84.9783,407.599,174.699,109.754,17.7784,96.0876,232.733,467.244,322.554,43.579,136.663,467.706,408.716,480.199,325.335,35.4412,196.114,238.861,28.4469,157.985,85.1769,151.306,265.277,242.437,1.19858,243.707,91.577,133.683,483.42,148.619,358.845,166.439,161.866,106.04,223.182,198.733, 253.151,125.841,397.846,164.292,58.0362,386.98,370.4,7.30672,472.859,236.674,106.122,264.87,472.661,492.967,15.5447,132.187,489.24,345.348,156.7,465.749,328.374,240.307,433.518,268.016,76.2234,115.466,36.6719,104.724,19.1872,228.486,166.272,98.4171,46.328,491.812,61.1499,333.547,73.6673,498.844,46.6052,202.36,84.4268,154.496,389.905,236.611,256.053,414.189,456.387,468.595,180.829,299.723,420.715,364.871,162.642,72.2363,255.443,267.454,117.314,80.4245,195.293,433.907,44.6469,81.58,149.688,232.548,460.22,427.084,259.782,495.937,205.167,13.8946,303.395,28.3416,25.3379,214.172,382.68,163.47,362.696,142.936,128.237,396.016,246.382,63.5113,432.945,462.109,202.735,481.931,284.257,230.561,242.515,55.8477,25.4743,234.624,38.3473,42.9531,222.079,207.283,14.0094,328.781,339.399,44.8123,151.314,186.845,212.161,148.796,404.932,124.334,279.217,186.688,203.197,142.403,494.96,456.127,460.683,87.5551,470.486,222.503,423.336,45.602,249.407,16.22,410.326,216.821,410.008,471.408,260.013,30.9757,198.847,323.611,355.081,406.642,419.63,137.924,152.883,265.239,424.67,181.797,192.2,178.684,454.185,459.295,268.865,134.082,205.778,444.075,358.539,417.261, 295.77,472.667,99.5259,387.285,97.9232,150.056,244.445,480.643,178.293,13.1318,92.5622,216.404,253.623,331.335,400.362,38.7207,299.438,372.04,132.497,404.639,94.6604,427.966,273.959,487.378,298.89,455.299,175.433,101.093,201.967,306.243,430.987,120.45,24.6742,294.111,339.425,404.045,271.051,462.777,439.063,366.325,471.613,91.7363,307.566,461.686,377.953,163.771,34.6073,474.307,80.0622,208.472,359.175,374.214,378.095,402.229,428.187,254.764,354.421,109.117,89.762,350.719,84.3694,146.341,150.699,484.394,112.756,55.6046,343.133,23.7084,234.804,391.834,309.526,49.4009,155.742,184.362,450.351,175.187,277.647,282.133,23.1639,420.422,423.226,174.016,433.402,70.7036,339.857,28.6748,283.703,86.3095,228.1,473.07,440.57,63.6011,493.296,82.2363,132.045,15.2001,338.555,397.874,181.694,340.013,61.9079,116.741,159.53,419.591,138.682,442.725,226.128,349.887,298.825 \}; 226.128,349.887,298.825 int cnt =0; int i=0; for (i=50 8\& array [i]150) cnt++; printf ("The numbers between 50 and 150 is: %i(n, cnt) ; return 0;} main.ct In function 'main': main.ci84:8: error: expected expression before "if" 841 If (array[1] s=50 a 8. array[1] \&e 150) main.c:86:74: error: expected expression before 'y' token 86 I printf ("The numbers between 50 and 150 ist 82n,cnt)B return 0;}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

How can assertiveness help you cope with anger? Critical T hinking

Answered: 1 week ago

Question

=+b. Who would the brand be as a famous person?

Answered: 1 week ago