Question:
Turbo C programming problems, please help!!?
PX
2009-03-09 03:08:11 UTC
1. Using 5x5 array, search a number, then determine and output the list of times it occurs on the list of 25 numbers entered.



- Hi Guys, I've done pretty much everything to make a program that can do what it is said in the questions run, but I just can't find a way to make it happen. So please? please type here the codes that are needed(What I mean is, the main code) to run this program, so that there'll be no problems like typographical errors.


Your answers will be very much appreciated. Super Thanks!!
Three answers:
Chie
2009-03-09 03:58:03 UTC
int arr[5][5];

int i, j, count, num; // num is the number to be search for, count is the frequency



// insert input for num here



for(i = 0; i < 5; i++) {

for(j = 0; j < 5; j++) {

if (arr[i][j] == num) count++;

}

}



// insert output for count here
Kaustubh
2009-03-09 03:35:20 UTC
Is your Qn is regarding find the frequency of a number from user-enterd 25 numbers??? then.....

#include

#include

main()

{

int A[25],i,j,num,count=0;



/*I m assuming that u know how to accept 5x5 matrix,so im give u directly the code that will find the freq. of a number.*/



printf("Enter a number that you want to search: ");

scanf("%d",&num);

/*this loop chks the number & calculates the freq.*/

for(i=0;i<5;i++)

{

for(j=0;j<5;j++)

{

if(A[i][j]==num) ++count;

}

}

printf("\n%d occurs %d times.",num,count);

getch();

return 0;

}
anonymous
2016-10-30 12:30:21 UTC
i do no longer know the similarities or variations between microsoft C and rapid C, yet i know which you will acquire seen Studio (which contains the c software language) from Microsoft for unfastened. i do no longer know how this differs from the version you will desire to pay for, yet i know you may improve in despite seen Studio languages that are supported. good success, and happy programming.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...