| | |
frequency problem,can u plz do the documentation for mi
![]() |
•
•
Join Date: Oct 2006
Posts: 6
Reputation:
Solved Threads: 0
/*QUESTION 2*/
C Syntax (Toggle Plain Text)
/*Program to compute frequency of a list of marks obtained by a group of students*/ #include <stdio.h> #define SIZE 100 main() { /*define n as number of students.x[SIZE] is a array to store marks of students*/ /*tempo[SIZE] is also used to store marks, but used in computation for frequency*/ /*In tempo[SIZE], elements are first arranged in ascending order to facilitate the computation of frequency*/ int i, j, n, temp, x[SIZE], tempo[SIZE]; /*read in the value of n, the number of students*/ printf("\n How many students?"); scanf("%d", &n); printf("\n\n"); /*Ask user to input marks*/ for(i=0; i<n;++i){ printf(" MARKS %d:", i+1); scanf("%d",&x[i]); tempo[i] = x[i]; printf("\n"); } /*End of for loop*/ /*display for frequency*/ /*reorder all array elements in ascending order*/ for(i=0; i<n-1; ++i){ /*beginning of outer for loop*/ /*find the smallest of all the remaining elements*/ for(j=i+1; j<n; ++j){ /*beginning of inner for loop*/ if(tempo[j]<tempo[i]){ /*interchange two elements*/ temp = tempo[i]; tempo[i] = tempo[j]; tempo[j] = temp; } /*end of if statement*/ } /*end of inner for loop*/ } /*end of outer for loop*/ /*computation of frequency*/ printf("\t"); return 0; }
Last edited by Salem; Oct 31st, 2006 at 2:59 am. Reason: Added code tags, learn to use them yourself
if you posted the wrong code then you need to post the correct code. We don't care if the code you posted doesn't work. Post the code you know how to do then we can talk about how to complete the assignment.
by "mark" do you mean "grade" ?
>>the interval between identical marks
what exactly does that mean?
by "mark" do you mean "grade" ?
>>the interval between identical marks
what exactly does that mean?
Last edited by Ancient Dragon; Oct 31st, 2006 at 11:17 pm.
![]() |
Similar Threads
- Problem, plz help (C)
- My Mp3 Player problem. (Storage)
- Printers problem. hard. pros in plz!! (USB Devices and other Peripherals)
- i have problem with array plz help (Java)
- Problem with Keyboard freezing (USB Devices and other Peripherals)
Other Threads in the C Forum
- Previous Thread: Using TObject *Sender
- Next Thread: Need Help With Printing Pascal's Triangle In C
| Thread Tools | Search this Thread |
#include * adobe ansi api array asterisks binarysearch centimeter changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc csyntax database directory dynamic execv feet fgets file fork function getlasterror getlogicaldrivestrin givemetehcodez global grade gtkgcurlcompiling gtkwinlinux hacking hardware highest histogram ide include incrementoperators infiniteloop input interest kernel keyboard kilometer license linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft motherboard mqqueue number odf opendocumentformat opensource owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing segmentationfault sequential single socket socketprograming standard string systemcall threads turboc unix user voidmain() wab whythiscodecausesegmentationfault windows.h windowsapi






