You are on page 1of 2

EJERCIOCIO 9

#include <stdio.h>
#include <conio.c>
void main(){
int i,j,l,c,n,m=0,w,JR,jyr,d,g,R,cla[50];
float pro=0,r,s=0,not[50];
char x;
do{
printf("DIGITE EL NUMERO DE ESTUDIANTES DESEA REGISTRAR...");
scanf("%d",&l);
system("cls");
}while(l<1||l>50);
do{
system("cls");
printf("DIGITE LA CLAVE DEL ESTUDIANTE %d \n",m+1);
scanf("%d",&cla[m]);
}while(cla[m]<1);
do{
system("cls");
printf("DIGITE NOTA FINAL ");
scanf("%f",&not[m]);
}while(not[m]<0||not[m]>5);
if(l!=1){
do{
m++;
do{
system("cls");
printf("DIGITE LA CLAVE DEL ESTUDIANTE %d \n",m+1);
scanf("%d",&g);
R=0;
for(i=0;i<m;i++){
if (cla[i]==g){
system("cls");
printf("LA CLAVE YA FUE REGISTRADA\n");
system("pause");
R=12;
}
}
if(R==12||g<1){
R=12;
}else{
cla[m]=g;
}
}while(R==12);
do{
system("cls");
printf("DIGITE NOTA FINAL ");
scanf("%f",&not[m]);
}while(not[m]<0||not[m]>5);
}while(m<l-1);
}
for (i=0;i<l;i++){
for (j=0;j<l;j++){
if (cla[i]>cla[j]){
n=cla[i];
cla[i]=cla[j];

cla[j]=n;
r=not[i];
not[i]=not[j];
not[j]=r;
}
}
}
for (i=0;i<l;i++){
s=s+not[i];
}
pro=(s/l);
system("cls");
printf("\n");
printf("EL PROMEDIO DE LAS NOTAS ES %0.2f\n",pro);
for (i=0;i<l;i++){
if(not[i]>pro){
printf("la(s) nota(s) superior(es) al promedio es(son):\n");
printf("CLAVE %d\n",cla[i]);
printf("NOTA %0.2f\n\n",not[i]);
}
}
do{
w=0;
system("pause");
system("cls");
printf("DIGITE LA CLAVE DEL ESTUDIANTE QUE DESEA BUSCAR\n");
scanf("%d",&c);
if (c>=1){
jyr=0;
for (i=0;i<l;i++){
if (c==cla[i]){
jyr=1;
}
}
}
if(jyr==1){
printf(" EL ESTUDIANTE CON CODIGO ( %d ) SE ENCUESTRA REGISTRADO\n",c);
}else{
printf(" EL ESTUDIANTE CON CLAVE ( %d ) NO SE ENCUESTRA REGISTRADO\n",c);
}
system("pause");
do{
system("cls");
printf(" si desea seguir buscando digite...[S]\n");
printf(" de lo contrario pulse .........[O]\n");
scanf(" %c",&x);
}while(x!='S'&&x!='s'&&x!='O'&&x!='o');
if(x=='S'||x=='s'){
w=1;
}
}while(w==1);
system("pause");
}

You might also like