Write a program using one dimensional array that searches a
number and display the number of times it occurs on the list
of 12 input values.
Sample input/output dialogue:
Enter 12 values:
13 15 20 13 30 35 40 16 18 20 18 20
Enter number to search: 20
Occurences: 3
Answers were Sorted based on User's Feedback
Answer / naveen kumar
change the sizeof array a[12] instead of a[4]
| Is This Answer Correct ? | 7 Yes | 15 No |
Answer / sreejesh1987
#include<stdio.h>
#include<conio.h>
void main()
{
int i,flag=0;
float s,a[4];
clrscr();
printf("Enter Twelve numbers:");
for(i=0;i<12;i++)
scanf("%f",&a[i]);
printf("Enter a number to search:");
scanf("%f",&s);
for(i=0;i<12;i++)
if(a[i]==s)
flag++;
printf("\nOccurances:%d",flag);
getch();
}
| Is This Answer Correct ? | 16 Yes | 32 No |
write a program that reverses the input number of n.Formulate an equation to come up with the answer.
find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L
Algorithm in O(2n) Presently we can solve in our hypothetical machine problem instances of size 100 in 1 minute using algorithm A, which is a O(2n). We would like to solve instances of size 200 in 1 minute using algorithm A on a new machine. What is the speed of the new machine should be?
2 Answers ABC, Qatar University,
How reader and writer problem was implemented and come up with effective solution for reader and writer problem in case we have n readers and 1 writer.
Coin Problem You are given 9 gold coins that look identical. One is counterfeit and weighs a bit greater than the others, but the difference is very small that only a balance scale can tell it from the real one. You have a balance scale that costs 25 USD per weighing. Give an algorithm that finds the counterfeit coin with as little weighting as possible. Of primary importance is that your algorithm is correct; of secondary importance is that your algorithm truly uses the minimum number of weightings possible. HINT: THE BEST ALGORITHM USES ONLY 2 WEIGHINGS!!!
1 Answers Motorola, Qatar University,
write a program to convert temperature from fa height into celcius and vise versa,use modular programming
0 Answers Jomo Kenyatta University,
How can I Draw an ellipse in 3d space and color it by using graph3d?
write a function -oriented program that generates the Fibonacci, the current numbers of n(as input) and display them (series). In Fibonacci, the current third number is the sum of the previous number.
write a function that reverse the elements of an array in place.The function must accept only one pointer value and return void.
Code for Method of Handling Factorials of Any Size?
. Remove all the blank spaces between character.Matrix is of 10* 10. eg: INPUT ------------------------------------ | N | A | | V | |T ------------------------------------- | |G | U | |P | -------------------------------------- |T | | | A | | ------------------------------------ OUTPUT: ------------------------------------ | N | A | V | T | | ------------------------------------- |G |U | P | | | -------------------------------------- |T | A | | | | ------------------------------------
How to Split Strings with Regex in Managed C++ Applications?