Note: Program needed has to be in C language compatible with Visual studio. Plea
ID: 3791989 • Letter: N
Question
Note: Program needed has to be in C language compatible with Visual studio. Please do not ignore the bonus problem. Thanks.
Please find the values to be copied into an array below:
71, 1899, 272, 1694, 1697, 296, 722, 12, 2726, 1899,
1374, 1541, 1923, 1904, 1083, 1462, 2981, 1929, 304, 2550,
1059, 1860, 1963, 516, 647, 1607, 590, 157, 2351, 753,
2455, 349, 79, 1634, 368, 1992, 2401, 357, 1478, 1601,
239, 365, 2453, 2283, 2432, 1223, 2739, 2487, 2714, 1391,
1972, 2805, 1504, 413, 1647, 2750, 44, 64, 934, 1008,
1429, 1427, 315, 2499, 1620, 1816, 2441, 2557, 2188, 531,
1514, 2825, 449, 265, 2064, 1022, 34, 1864, 1861, 1516,
1465, 2327, 398, 2769, 563, 194, 429, 942, 1795, 223,
2406, 780, 780, 61, 133, 195, 495, 1774, 1934, 2171,
433, 1417, 292, 324, 2929, 1597, 1470, 764, 593, 891,
679, 47, 1778, 2532, 1862, 2636, 549, 2923, 2270, 1101,
1607, 2395, 726, 1111, 892, 1988, 555, 379, 224, 298,
1660, 2203, 2385, 2159, 2574, 705, 2513, 1755, 313, 173,
148, 2449, 259, 1006, 1221, 2259, 2020, 1484, 2717, 2400,
266, 1203, 2206, 357, 1294, 1153, 2820, 1858, 2062, 1499,
1422, 2343, 956, 2677, 468, 910, 2719, 1850, 825, 362,
288, 963, 843, 689, 2800, 1363, 1384, 1926, 1816, 746,
124, 2970, 1577, 2727, 1344, 276, 494, 1252, 333, 1862,
502, 2277, 890, 322, 70, 2969, 1745, 2205, 2919, 2837,
744, 203, 1699, 37, 767, 2611, 1262, 2052, 2118, 1412,
2642, 741, 1841, 1520, 892, 1659, 1030, 2016, 1158, 1566,
2070, 2272, 20, 2631, 1059, 2277, 2234, 1807, 921, 588,
965, 251, 175, 1452, 1138, 114, 648, 2223, 1509, 1513,
1061, 1221, 1035, 911, 2973, 2250, 2337, 1181, 832, 2137,
334, 1144, 1312, 2137, 2662, 2987, 778, 943, 1665, 38,
875, 1148, 2483, 2715, 814, 520, 1645, 2571, 1085, 150,
2933, 2156, 2878, 1090, 1353, 510, 2872, 1209, 801, 1518,
1805, 128, 1286, 922, 2515, 1352, 1470, 1039, 1990, 288,
2489, 2935, 1360, 819, 392, 2519, 2612, 2972, 1173, 2136,
2087, 2255, 62, 427, 1488, 1378, 798, 219, 993, 2916,
1773, 630, 1221, 1868, 1726, 1420, 1006, 2053, 2386, 1451,
2128, 1905, 2588, 1050, 1768, 1548, 284, 989, 545, 2538,
192, 2121, 2837, 251, 1720, 208, 603, 1445, 1392, 70,
2665, 507, 108, 445, 451, 470, 2814, 2278, 290, 1225,
1420, 857, 2415, 1313, 520, 1359, 666, 124, 1744, 190,
2383, 1177, 2855, 1261, 2624, 2625, 99, 2417, 1961, 1276,
769, 2447, 159, 895, 1957, 626, 2123, 1668, 2231, 1791,
974, 163, 2410, 2160, 2100, 2496, 599, 1190, 2494, 1349,
2490, 2922, 2379, 1705, 1299, 1109, 2680, 713, 1223, 2943,
2784, 550, 1615, 2853, 388, 2839, 74, 879, 734, 1432,
2031, 1073, 2611, 1939, 1566, 2535, 1687, 599, 2048, 2990,
1637, 1638, 2075, 257, 1352, 2939, 570, 1642, 1108, 2859,
1412, 1177, 392, 1643, 1996, 1682, 1136, 1339, 1042, 2106,
2229, 1890, 328, 122, 1392, 1706, 623, 823, 2703, 2693,
842, 2329, 1815, 2647, 1883, 2698, 1371, 1086, 2006, 2650,
1652, 488, 1123, 17, 290, 1324, 2495, 1221, 2361, 1244,
813, 2716, 1808, 2328, 2840, 1059, 2382, 2391, 2453, 1672,
1469, 778, 2639, 357, 2691, 1113, 2131, 23, 2535, 1514,
2317, 45, 1465, 1799, 2642, 557, 1846, 1824, 1144, -1
Explanation / Answer
#include<stdio.h>
#include<conio.h>
int main()
{
int i,no;
int array[]={71, 1899, 272, 1694, 1697, 296, 722, 12, 2726, 1899,1374, 1541, 1923, 1904, 1083, 1462, 2981, 1929, 304, 2550,1059, 1860, 1963, 516, 647, 1607, 590, 157, 2351, 753,
2455, 349, 79, 1634, 368, 1992, 2401, 357, 1478, 1601,239, 365, 2453, 2283, 2432, 1223, 2739, 2487, 2714, 1391,1972, 2805, 1504, 413, 1647, 2750, 44, 64, 934, 1008,1429, 1427, 315, 2499, 1620, 1816, 2441, 2557, 2188, 531,4, 2825, 449, 265, 2064, 1022, 34, 1864, 1861, 1516,1465, 2327, 398, 2769, 563, 194, 429, 942, 1795, 223,
2406, 780, 780, 61, 133, 195, 495, 1774, 1934, 2171,433, 1417, 292, 324, 2929, 1597, 1470, 764, 593, 891,679, 47, 1778, 2532, 1862, 2636, 549, 2923, 2270, 1101,1607, 2395, 726, 1111, 892, 1988, 555, 379, 224, 298,
1660, 2203, 2385, 2159, 2574, 705, 2513, 1755, 313, 173,148, 2449, 259, 1006, 1221, 2259, 2020, 1484, 2717, 2400,266, 1203, 2206, 357, 1294, 1153, 2820, 1858, 2062, 1499,
1422, 2343, 956, 2677, 468, 910, 2719, 1850, 825, 362,288, 963, 843, 689, 2800, 1363, 1384, 1926, 1816, 746,124, 2970, 1577, 2727, 1344, 276, 494, 1252, 333, 1862,502, 2277, 890, 322, 70, 2969, 1745, 2205, 2919, 2837,
744, 203, 1699, 37, 767, 2611, 1262, 2052, 2118, 1412,2642, 741, 1841, 1520, 892, 1659, 1030, 2016, 1158, 1566,2070, 2272, 20, 2631, 1059, 2277, 2234, 1807, 921, 588,
965, 251, 175, 1452, 1138, 114, 648, 2223, 1509, 1513,1061, 1221, 1035, 911, 2973, 2250, 2337, 1181, 832, 2137,334, 1144, 1312, 2137, 2662, 2987, 778, 943, 1665, 38,
875, 1148, 2483, 2715, 814, 520, 1645, 2571, 1085, 150,2933, 2156, 2878, 1090, 1353, 510, 2872, 1209, 801, 1518,1805, 128, 1286, 922, 2515, 1352, 1470, 1039, 1990, 288,
2489, 2935, 1360, 819, 392, 2519, 2612, 2972, 1173, 2136,2087, 2255, 62, 427, 1488, 1378, 798, 219, 993, 2916,1773, 630, 1221, 1868, 1726, 1420, 1006, 2053, 2386, 1451,
2128, 1905, 2588, 1050, 1768, 1548, 284, 989, 545, 2538,192, 2121, 2837, 251, 1720, 208, 603, 1445, 1392, 70,2665, 507, 108, 445, 451, 470, 2814, 2278, 290, 1225,
1420, 857, 2415, 1313, 520, 1359, 666, 124, 1744, 190,2383, 1177, 2855, 1261, 2624, 2625, 99, 2417, 1961, 1276,769, 2447, 159, 895, 1957, 626, 2123, 1668, 2231, 1791,
974, 163, 2410, 2160, 2100, 2496, 599, 1190, 2494, 1349,2490, 2922, 2379, 1705, 1299, 1109, 2680, 713, 1223, 2943,2784, 550, 1615, 2853, 388, 2839, 74, 879, 734, 1432,
2031, 1073, 2611, 1939, 1566, 2535, 1687, 599, 2048, 2990,1637, 1638, 2075, 257, 1352, 2939, 570, 1642, 1108, 2859,1412, 1177, 392, 1643, 1996, 1682, 1136, 1339, 1042, 2106,2229, 1890, 328, 122, 1392, 1706, 623, 823, 2703, 2693,
842, 2329, 1815, 2647, 1883, 2698, 1371, 1086, 2006, 2650,1652, 488, 1123, 17, 290, 1324, 2495, 1221, 2361, 1244,813, 2716, 1808, 2328, 2840, 1059, 2382, 2391, 2453, 1672,1469, 778, 2639, 357, 2691, 1113, 2131, 23, 2535, 1514,
2317, 45, 1465, 1799, 2642, 557, 1846, 1824, 1144, -1};
int count=0;
printf("enter the no to search in the array");
scanf("%d",&no);
for(i=0;i<sizeof(array);i++)
{
if(no==array[i])
{
printf("the no is found at index %d ",i);//this is different way to catch the index iam counting to 1
count++;
}
}
printf("the no appeared in the array %d ",count);//counttin 1 display no of times it appeared in the array
return 0;
}
output
enter the no to search in the array
1059
the no is found at index 20
the no is found at index 224
the no is found at index 475
the no is found at index 501
the no appeared in the array 4
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.