Advertisement

Choice of entering marks::


#include<conio.h>
#include<stdio.h>
void main()
{
int a[10],i,n,m,d;
float b;
printf("\n 1.input \n 2.output \n 3.highest marks \n 4.lowest marks \n 5.mean of the marks");
printf("\n\n Enter your choice:");
scanf("%d",&d);
switch(d)
{case 1:
n=1;
for(i=0;i<=9;i++)
{printf("\n %d.",n);
scanf("%d",&a[i]);
n++;}
break;
case 2:
n=1;
for(i=0;i<=9;i++)
{printf("\n %d.",n);
printf("%d",a[i]);
n++;}
break;
case 3:
printf("\n \n calculation of highest marks");
m=a[0];
for(i=0;i<=9;i++)
{if(m<a[i])
m=a[i];}
printf("\n %d",m);
break;
case 4:
printf("\n \n calculation for lowest marks");
m=a[0];
for(i=0;i<=10;i++)
{if(m>a[i])
m=a[i];}
printf("\n %d",m);
break;
case 5:
printf("\n \n calculation of mean of the marks");
m=0;
for(i=0;i<=9;i++)
{m=m+a[i];}
b=m/10;
printf("\n %f",b);
break;
default:("not match");
                                       }
getch();}

No comments:

Post a Comment

Please comment bellow. Share your knowledge