Wednesday

Write a program in C to store mark obtained by ‘n’ students and count the number of students who obtained mark greater than 70. Also count the number of students who are failed.

#include<stdio.h>
#include<conio.h>
void main()
 {
  int n,i,c=0,cf=0;
  float m[100];
  clrscr();
  printf("\nEnter how many students?");
  scanf("%d",&n);
  printf("\n Enter marks for %d students: ",n);
  for(i=0;i<n;i++)
  scanf("%f",&m[i]);
  for(i=0;i<n;i++)
  if(m[i]>70)
  c=c+1;
  else if(m[i]<35)
  cf=cf+1;
  printf("\n Total no. of students scoring more than 70 are %d ",c);
  printf("\nTotal no. of students who are fail are %d ",cf);
 getch();
 }

No comments:

Post a Comment

Rahul-Notes