/*QUESTION 2*/

/*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;
}

sorry i sent the wrong code..anyways can u help me...can u tell me another way of solvin this problem...this program allows input of number of students,marks for each student,the frequency for each mark, the interval between identical marks...

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?

This article has been dead for over six months. Start a new discussion instead.