Sei sulla pagina 1di 19

1 MESES DEL ANO

// Meses Del Año.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
#define m 12

void main()
{
int i,k; /*Variables Auxiliares*/
char AUX[15];
char MES[m][15];/*m Meses(12) y 15 caracteres cada mes*/
/*INTRODICIR DATOS AL VECTOR*/
printf("Introduzca los meses del ano:\n");
for (i=0;i<m;i++)
{
printf("[%d]:",i);
scanf("%s",MES[i]);
}
/*MOSTRAR LOS DATOS DEL VECTOR*/

printf("\nLOS DATOS INTRODUCIDOS SON:\n");


for(i=0;i<m;i++)
{
printf("[%d]:%s\n",i,MES[i]);
}

/*ORDEMAMEINTO DEL VECTOR ALFABETICAMENTE*/

for(k=0;k<(m-1);k++)
{
for(i=0;i<(m-1);i++)
{
if (strcmp(MES[i],MES[i+1])>0)
{
strcpy(AUX,MES[i]);
strcpy(MES[i],MES[i+1]);
strcpy(MES[i+1],AUX);
}
}
}

/*Imprimir El Vector Ordenado*/


printf("\nVECTOR ORDENADO ALFABETICAMENTE:\n");
for(i=0;i<m;i++)
{
printf("[%d]:%s\n",i,MES[i]);
}

getch();
getch();
}
2. SEGUNDO
// N personas Ordenado.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "conio.h"
#include "stdio.h"
#include "string.h"
#define N 100

void main()
{
int i,k,p; /*Variables auxiliares*/
char AUX[15];
char PERSONAS[N][15]; /*Variable del Vector*/

printf("Introduzca el numero de personas que desea introducir:");


scanf("%d",&p);

/*INTRODUCCION DE DATOS AL VECTOR*/


printf("\nINTRODUZCA LOS NOMBRES:\n");
for(i=0;i<p;i++)
{
printf("[%d]:",i);
scanf("%s", PERSONAS[i]);
}

/*MOSTRAR NOMBRES INTRODUCIDOS AL VECTOR*/


printf("\nLOS NOMBRES INTRODUCIDOS AL VECTOR SON:\n");
for(i=0;i<p;i++)
{
printf("[%d]:%s\n",i,PERSONAS[i]);
}

/*ORDENAMIENTO DEL VECTOR*/


for(k=0;k<(p-1);k++)
{
for(i=0;i<(p-1);i++)
{
if (strcmp(PERSONAS[i],PERSONAS[i+1])<0)
{
strcpy(AUX,PERSONAS[i]);
strcpy(PERSONAS[i],PERSONAS[i+1]);
strcpy(PERSONAS[i+1],AUX);
}
}
}

/*MOSTRAR EL VECTOR ORDENADO*/


printf("\nLOS NOMBRES ORDENADOS DESCENDENTEMENTE SON:\n");
for(i=0;i<p;i++)
{
printf("[%d]:%s\n",i,PERSONAS[i]);
}

getch();
getch();
}
3. TERCERO

// probema 3.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
#define C 100

void main()
{
int k,i,p,AUX; /*Varaibles auxiliares*/
int REGISTRO[C]; /*Vector del numero de registro*/
char AP[C][10];/*Vector con los apellidos*/
char AUX2[10]; /*Variable auxiliar para caracteres*/

printf("Introduzca la cantidad de personas:");


scanf("%d",&p);

/*INTRODUCCION DE DATOS A LOS VECTORES*/

printf("\nINTRODUZCA EL NUMERO DE REGISTRO Y APELLIDO SEPARADOS POR UN ESPACIO


Ej: 01234 XXXXX:\n");
for(i=0;i<p;i++)
{
printf("[%d]:",i);
scanf("%d %s",&REGISTRO[i],AP[i]);
/*Validacion de datos para impedir los incorrectos, blancos o nulos*/
if (AP[i]==0)
{
printf("\nERROR: NO INTRODUJO EL APELLIDO O NO ES VALIDO\n,");
printf("\VUELVA A INTRODUCIR LA INFORMACION COMPLETA.Ej: 01234
XXXXX:\n");
strcpy(AP[i],"");
i=i-1;
}
if (REGISTRO[i]<=0)
{
printf("\nERROR: NO INTRODUJO EL NUMERO DE REGISTRO O NO ES
VALIDO\n,");
printf("\VUELVA A INTRODUCIR LA INFORMACION COMPLETA.Ej: 01234
XXXXX:\n");
i=i-1;
REGISTRO[i]=0;
}
}

/*NOSTRAR LOS DATOS INTRODUCIDOS EN LOS VECTORES*/

printf("\nLOS NUMEROS DE REGISTROS INTRODUCIDOS SON:\n");


for(i=0;i<p;i++)
{
printf("[%d]:%d\n",i,REGISTRO[i]);
}
printf("\nLOS APELLIDOS INTRODUCIDOS SON:\n");
for(i=0;i<p;i++)
{
printf("[%d]:%s\n",i,AP[i]);
}
/*ORDENAMIENTO DE LOS VECTORES EN ORDEN ALFABETICO POR LOS APELLIDOS*/
for(k=0;k<(p-1);k++)
{
for(i=0;i<(p-1);i++)
{
if(strcmp(AP[i],AP[i+1])>0)
{
strcpy(AUX2,AP[i]);
strcpy(AP[i],AP[i+1]);
strcpy(AP[i+1],AUX2);

AUX=REGISTRO[i];
REGISTRO[i]=REGISTRO[i+1];
REGISTRO[i+1]=AUX;
}
}
}

/*MOSTRAR EL VECTOR ORDENADO ALFABETICAMENTE*/


printf("\nLOS VECTORES ORDENADOS ALFABETICAMENTE DE ACUERDO AL APELLIDO:\n");
for(i=0;i<p;i++)
{
printf("[%d]:%d - %s\n",i,REGISTRO[i],AP[i]);
}

getch();
getch();
}
4. CUARTO
// Problema 4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
#define m 100

void main ()
{
int i,k,n,AUX; /*Variables auxiliares*/
float P1[m],P2[m],P3[m],PR[m]; /*Vectores para los examenes*/
char ALU[m][15]; /*Vector de los nombres para los alumnos*/
char AUX2[15]; /*Variable auxiliar para los caracteres*/

printf("\nIntroduzca el numero de alumnos:");


scanf("%d",&n);

/*INTRODUCCION DE LOS DATOS A LOS VECTORES Y SUS RESPECTIVAS VALIDACIONES


PARA CADA UNO*/
printf("\nINTRODUZCA LOS NOMBRES DE LOS ALUMNOS\n");
for(i=0;i<n;i++)
{
printf("[%d]:",i);
scanf("%s",ALU[i]);
}
printf("\nINTRODUZCA LAS NOTAS DEL PRIMER EXAMEN DE CADA ALUMNO:\n");
for(i=0;i<n;i++)
{
printf("[%s]:",ALU[i]);
scanf("%f",&P1[i]);
if((P1[i]<=0) || (P1[i]>100))
{
printf("\nERROR: La nota introducida no es valida, vuelva a introducirla\n");
P1[i]=0;
i=i-1;
}
}
printf("\nINTRODUZCA LAS NOTAS DEL SEGUNDO EXAMEN DE CADA ALUMNO:\n");
for(i=0;i<n;i++)
{
printf("[%s]:",ALU[i]);
scanf("%f",&P2[i]);
if((P2[i]<=0) || (P2[i]>100))
{
printf("\nERROR: La nota introducida no es valida, vuelva a introducirla\n");
P2[i]=0;
i=i-1;
}
}
printf("\nINTRODUZCA LAS NOTAS DEL TERCER EXAMEN DE CADA ALUMNO:\n");
for(i=0;i<n;i++)
{
printf("[%s]:",ALU[i]);
scanf("%f",&P3[i]);
if((P3[i]<=0) || (P3[i]>100))
{
printf("\nERROR: La nota introducida no es valida, vuelva a introducirla\n");
P3[i]=0;
i=i-1;
}
}

/*MOSTRAR LOS DATOS DE LOS VECTORES*/


printf("\LOS DATOS INTRODUCIDOS SON:\n");
printf("\nNOMBRE P1 P2 P3\n");
for(i=0;i<n;i++)
{
printf("%s %.1f %.1f %.1f\n",ALU[i],P1[i],P2[i],P3[i]);
}

/*CALCULAR EL PROMEDIO DE LAS NOTAS DE CADA ALUMNO*/


for(i=0;i<n;i++)
{
PR[i]=(P1[i]+P2[i]+P3[i])/3;
}

/*MOSTRAR EL PROMEDIO DE LOS ALUMNOS*/


printf("\nEL PROMEDIO DE LOS ALUMNOS ES:\n");
for(i=0;i<n;i++)
{
printf("[%s]: %3.2f\n",ALU[i],PR[i]);
}
/*ORDENAR DE ACUERDO A SUS PROMEDIOS*/
for(k=0;k<(n-1);k++)
{
for(i=0;i<(n-1);i++)
{
if(PR[i]<PR[i+1])
{
AUX=PR[i];
PR[i]=PR[i+1];
PR[i+1]=AUX;

strcpy(AUX2,ALU[i]);
strcpy(ALU[i],ALU[i+1]);
strcpy(ALU[i+1],AUX2);
}
}
}

/*MOSTRAR EL MAYOR PROMEDIO*/


printf("\nEL MAYOR PROMEDIO ES:\n");
printf("%s: %3.2f\n",ALU[0],PR[0]);

/*MOSTRAR LOS 3 MEJORES PROMEDIOS*/


printf("\nLOS 3 MEJORES PROMEDIOS SON:\n");
for(i=0;i<3;i++)
{
printf("%s: %3.2f\n",ALU[i],PR[i]);
}
/*MOSTRAR EL NUMERO DE APROVADOS Y REPROBADOS*/
AUX=0;
k=0;
for(i=0;i<n;i++)
{
if (PR[i]>=51)
{
AUX=AUX+1;
}
else
{
k=k+1;
}
}

printf("\nEL NUMERO DE APROVADOS ES DE:%d\n",AUX);


printf("EL NUMERO DE REPROVADOS ES DE:%d\n",k);

getch();
getch();
}
5. QUINTO

// Problema 5.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
#define N 100

void main()
{
int i,k,c,x; /*Variables Auxiliares*/
int REG[N]; /*Vector del numero de registro de los alumnos*/
float P1[N],P2[N],PF[N]; /*Vectores de los examenes 1 y 2 y el promedio de estos*/
float AUX; /*Varialble auxiliar para REALES*/
char NOM[N][15]; /*VECTOR DE LOS MOMBRES DE LOS ALUMNOS de 15 caracteres*/
char AUX2[15]; /*Auxiliar para caracteres*/

printf("INTRODUZCA EL NUMERO DE ALUMNOS:");


scanf("%d",&c);

/*INTRODUCCION DE DATOS A LOS VECTORES*/


printf("\nINTRODUZCA EL NOMBRE DE LOS ALUMNOS:\n");
for(i=0;i<c;i++)
{
printf("[%d]:",i);
scanf("%s",NOM[i]);
}
printf("\nINTRODUZCA EL NUMERO DE REGISTRO PARA CADA ALUMNO:\n");
for(i=0;i<c;i++)
{
printf("[%s]:",NOM[i]);
scanf("%d",&REG[i]);
}

/*MOSTRAR LOS DATOS INGRESADOS HASTA AHORA*/


printf("\nLOS MUMEROS DE REGISTRO CORRESPONDEN A:\n");
for(i=0;i<c;i++)
{
printf("[%d]:%s\n",REG[i],NOM[i]);
}

/*INTRODUCCION DE LAS NOTAS EN LOS VECTORES*/


printf("\nINTRODUZCA LAS NOTAS DEL PRIMER EXAMEN PARA CADA ALUMNO:\n");
for(i=0;i<c;i++)
{
printf("[%s]:",NOM[i]);
scanf("%f",&P1[i]);
}
printf("\nINTRODUZCA LAS NOTAS DEL SEGUNDO EXAMEN PARA CADA ALUMNO:\n");
for(i=0;i<c;i++)
{
printf("[%s]:",NOM[i]);
scanf("%f",&P2[i]);
}
/*CALCULO DEL PROMEDIO DE CADA ALUMNO*/
for(i=0;i<c;i++)
{
PF[i]=(P1[i]+P2[i])/2;
}

/*ORDENAR LOS VECTORES DE ACUERDO AL PROMEDIO EN ORDEN DESCENDENTE*/


for(k=0;k<(c-1);k++)
{
for(i=0;i<(c-1);i++)
{
if (PF[i]<PF[i+1])
{
AUX=PF[i];
PF[i]=PF[i+1];
PF[i+1]=AUX;

AUX=REG[i];
REG[i]=REG[i+1];
REG[i+1]=AUX;

AUX=P1[i];
P1[i]=P1[i+1];
P1[i+1]=AUX;

AUX=P2[i];
P2[i]=P2[i+1];
P2[i+1]=AUX;

strcpy(AUX2,NOM[i]);
strcpy(NOM[i],NOM[i+1]);
strcpy(NOM[i+1],AUX2);
}
}
}

/*MOSTRAR EL MAYOR PROMEDIO*/


printf("\nEL MAYOR PROMEDIO ES:\n");
printf("%s:%3.2f\n",NOM[0],PF[0]);

/*MOSTRAR TODOS LOS DATOS DE LOS 3 PRIMEROS*/


printf("\nMOSTRAR TODOS LOS DATOS DE LOS 3 PRIMEROS:\n");
for(i=0;i<3;i++)
{
printf("%s: %d\n",NOM[i],REG[i]);
printf(" -Promedio: %3.2f\n",PF[i]);
}
/*CALCULAR y MOSTRAR NUMERO DE APROVADOS Y REPROVADOS*/
k=0;
x=0;
for(i=0;i<c;i++)
{
if (PF[i]>=51)
{
x=x+1;
}
else
{
k=k+1;
}
}
printf("\nEL NUMERO DE APROVADOS ES: %d",x);
printf("\nEL NUMERO DE REPROVADOS ES: %d",k);

/*MOSTRAR EL Nº DE REGISTRO, NOMBRE Y PROMEDIO DE LOS REPROVADOS*/


printf("\nLA INFORMACION DE LOS REPROVADOS ES:\n");
for(i=0;i<c;i++)
{
if (PF[i]<=51)
{
printf("%s: %d\n",NOM[i],REG[i]);
printf(" -Promedio: %3.2f\n",PF[i]);
}
}

getch();
getch();
}
6. SEXTO

#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
#define limite 1000

void main()
{
int A[limite], B[limite], Z[limite];
int c=0, i, a, b, k;
printf("VECTOR A\n");
printf("Introduzca el numero de elementos de A: ");
scanf("%d", &a);
for(i=0;i<a;i++)
{
printf("[%d]:", i);
scanf("%d", &A[i]);
}

printf("VECTOR B\n");
printf("Introduzca el numero de elementos de B: ");
scanf("%d", &b);
for(i=0;i<b;i++)
{
printf("[%d]:", i);
scanf("%d", &B[i]);
}
//COMPARANDO A CON B
for(k=0;k<a;k++)
{
for(i=0;i<b;i++)
{
if(A[i]==B[k])
{
Z[c]=A[i];
c++;
}
}
}

printf("VECTOR Z\n");

for(i=0;i<c;i++)
{
printf("[%d]:", i);
printf("%d\n", Z[i]);
}
if(c==0)
{
printf("No exiten elementos comunes");
}

getch();
}
7. SEPTIMO

#include "stdafx.h"
#include "conio.h"
#include "stdio.h"
#include "string.h"
#define C 1000

void main()
{
int REG[C],ANO[C]; /*Vectores de Codigo de Registro y Año de Ingreso*/
int i,k,c,a0=0,a1=0,a2=0,a3=0,a4=0,a5=0,a6=0,a7=0,a8=0,a9=0; /*Variables Auxiliares y variables de los
Años*/
char CAR[C][25];/*Vector de Nombre De La Carrera con 25 caracteres como maximo*/

/*INGRESO DE DATOS A LOS VECTORES*/


printf("Introduzca el numero de alumnos: ");
scanf("%d",&c);
for(i=0;i<c;i++)
{
printf("\n\nIntroduzca el Codigo del alumno: ");
scanf("%d",&REG[i]);
printf("\nIntroduzca la carrera del alumno sin espacios: ");
scanf("%s", CAR[i]);
printf("\nIntroduzca el ano de ingreso a la Universidad: ");
scanf("%d",&ANO[i]);
}
for(i=0;i<c;i++)
{
if(ANO[i]==2000)
{
a0++;
}
if(ANO[i]==2001)
{
a1++;
}
if(ANO[i]==2002)
{
a2++;
}
if(ANO[i]==2003)
{
a3++;
}
if(ANO[i]==2004)
{
a4++;
}
if(ANO[i]==2005)
{
a5++;
}
if(ANO[i]==2006)
{
a6++;
}
if(ANO[i]==2007)
{
a7++;
}
if(ANO[i]==2008)
{
a8++;
}
if(ANO[i]==2009)
{
a9++;
}
}

/*MOSTRAR LOS ALUMNOS QUE INGRESARON POR EL AÑO RESPECTIVO*/


printf("\nINGRESO DE ALUMNOS POR SU ANO RESPECTIVO:\n\n");
printf("Ingresaron %d Aumnos en el año 2000\n",a0);
printf("Ingresaron %d Aumnos en el año 2001\n",a1);
printf("Ingresaron %d Aumnos en el año 2002\n",a2);
printf("Ingresaron %d Aumnos en el año 2003\n",a3);
printf("Ingresaron %d Aumnos en el año 2004\n",a4);
printf("Ingresaron %d Aumnos en el año 2005\n",a5);
printf("Ingresaron %d Aumnos en el año 2006\n",a6);
printf("Ingresaron %d Aumnos en el año 2007\n",a7);
printf("Ingresaron %d Aumnos en el año 2008\n",a8);
printf("Ingresaron %d Aumnos en el año 2009\n",a9);
getch();
getch();
}
8. OCTAVO

#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "math.h"
#define N 8

void main()
{
double CHESS[N][N]; /*MATRIZ DEL TABLERO DE AJEDRES*/
double total=0; /*TOTAL DE GRANOS DE MAIZ*/
int i,k,x=0; /*Variables Auxiliares y variable contador*/

for(i=0;i<N;i++)
{
for(k=0;k<N;k++)
{
CHESS[i][k]=powf(2,x);
x++;
total=total+CHESS[i][k];
}
}
for(i=0;i<N;i++)
{
printf("\n\n\nFILA %d \n\n\n",i);
for(k=0;k<N;k++)
{
printf(" | %.0lf | ", CHESS[i][k]);
}
}

printf("\n\n\n LOS GRANOS QUE SE PUEDEN COLOCAR EN UN TABLERO DE AJEDRES ES DE:\n


%.0lf",total);

getch();
}
9. NOVENO
// Problema 9.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "conio.h"
#include "stdio.h"
#include "string.h"
#define C 1000

void main()
{
int i,k,c; /*Variabls Auxiliares*/
float AUX;
float PREC[C]; /*Vector Del Precio del Producto*/
char COD[C][6], DES[C][10];/*Vectores del codiogo y descripcion del producto*/
char AUX2[30];

printf("Introduzca la cantidad de productos que va a ingresar a la base de datos:");


scanf("%d",&c);

/*INTRODUCCION DE DATOS AL VECTOR*/


for(i=0;i<c;i++)
{
printf("\n\nINTRODUZCA EL CODIGO DEL ARTICULO (MAX 5 LETRAS):");
scanf("%s",COD[i]);
printf("\nINTRODUZCA EL PRECIO DEL ARTICULO:");
scanf("%f",&PREC[i]);
printf("\nINTRODUZCA LA DESCRIPCION DEL ARTICULO (_ para espacios):");
scanf("%s",DES[i]);

/*MOSTRAR DATOS DE LOS VECTORES*/


printf("\nLOS PRODUCTOS INTRODUCIDOS SON:\n\n");
for(i=0;i<c;i++)
{
printf("\n\nPRODUCTO %d \n",i);
printf("Codigo: %s ",COD[i]);
printf("\nDescripcio del Producto: %s \nPrecio: %f \n",DES[i],PREC[i]);
}

/*ORDEMAMIENTO DE LOS VECTORES*/


for(k=0;k<(c-1);k++)
{
for(i=0;i<(c-1);i++)
{
if (PREC[i]<PREC[i+1])
{
AUX=PREC[i];
PREC[i]=PREC[i+1];
PREC[i+1]=AUX;

strcpy(AUX2,COD[i]);
strcpy(COD[i],COD[i+1]);
strcpy(COD[i+1],AUX2);

strcpy(AUX2,DES[i]);
strcpy(DES[i],DES[i+1]);
strcpy(DES[i+1],AUX2);
}
}
}
/*MOSTRAR LOS 3 PRODUCTOS MAS CAROS DE LA BASE DE DATOS*/

printf("\n\nLOS 3 PRODUCTOS MAS CAROS DE LA BASE DE DATOS SON:\n\n");


for(i=0;i<c;i++)
{
printf("\n\nPRODUCTO %d \n",i);
printf("Codigo: %s \nDescripcio del Producto: %s \nPrecio: %.2f \n",COD[i],DES[i],PREC[i]);
}

getch();
}
10. DECIMO

#include "stdafx.h"
#include "stdio.h"
#include "conio.h"
#include "string.h"
#define N 1000

void main()
{
int i,k,AUX,x,a=0,b,c,suma1,suma2,p1,p2,p3,dp; /*Variables Auxiliares*/
char NOM[N][15],AUX2[15]; /*VECTOR PARA LOS NOMBRES y variable auxiliar para caracteres*/
int EDAD[N],EDU[N];/*VECTORES PARA LA EDAD Y GRADO DE EDUCACION*/
float SAL[N]; /*VECTOR PARA EL SALARIO*/

printf("INTRODUZCA EL NUMERO DE PERSONAS:");


scanf("%d",&x);

/*INTRODUCCION DE DATOS AL VECTOR*/

for(i=0;i<x;i++)
{
printf("\nINTRODUZCA EL NOMBRE[%d]:",i);
scanf("%s", NOM[i]);
printf("\nINTRODUZCA EL MONTO DEL SALARIO DE %s :",NOM[i]);
scanf("%f",&SAL[i]);
printf("\nINTRODUZCA LA EDAD DE %s :",NOM[i]);
scanf("%d",&EDAD[i]);
printf("\INTRODUZCA EL GRADO DE EDUCACION DE %s DE ACUERDO A LA
SIGUIENTE TABLA:\n",NOM[i]);
printf("1 Primarios\n");
printf("2 Secundarios\n");
printf("3 Superior\n");
printf("OPCION: ");
scanf("%d",&EDU[i]);
}

/*MOSTRAR LOS DATOS DE LOS VECTORES*/


printf("\nDATOS INTRODUCIDOS:\n\n");
for(i=0;i<x;i++)
{

printf("\nNOMBRE: %s \n| SALARIO: %10.2f | EDAD: %d | CODIGO DE EDUCACION:%d


\n\n",NOM[i],SAL[i],EDAD[i],EDU[i]);
}
getch();
/*Numero de personas q tienen educacion superior y ganan menos de %$1.000*/
for(i=0;i<x;i++)
{
if ((EDU[i]==3) && (SAL[i]<1000))
{
a++;
}
}
printf("\nEL NUMERO DE PERSONAS QUE TIENE UNA EDUCACION SUPERIOR Y GANAN
MENOS DE 1.000$ ES DE: %d",a);
getch();

/*Calcular la diferencia de promedios de los salarios de mas o = de 30 años y las que tiene menos de 30
años*/
a=0;
suma1=0;
b=0;
suma2=0;
for(i=0;i<x;i++)
{
if(EDAD[i]>=30)
{
a++;
suma1=suma1+SAL[i];
}
if(EDAD[i]<30)
{
b++;
suma2=suma2+SAL[i];
}
}
p1=suma1/a;
p2=suma2/b;
if(p1>p2)
{
dp=suma1-suma2;
}
if (p2>p1)
{
dp=suma2-suma1;
}

printf("\nLA DIFERENCIA DE PROMEDIOS DEL SALARIO DE MAYORES Y MENORES DE 30


ANOS ES DE: %d\n",dp);
getch();

/*CALCULAR EL PORCENTAJE DE PERSONAS SEGUN GRADO DE EDUCACION*/

a=0;
b=0;
c=0;
for(i=0;i<x;i++)
{
if(EDU[i]==1)
{
a++;
}
if(EDU[i]==2)
{
b++;
}
if(EDU[i]==3)
{
c++;
}
}
p1=(a*100)/x;
p2=(b*100)/x;
p3=(c*100)/x;

printf("\nEL PORCENTAJE DE PERSONAS QUE ALCANZO EL GRADO PRIMARIO ES DE: %d


%",p1);
printf("\nEL PORCENTAJE DE PERSONAS QUE ALCANZO EL GRADO SECUNDARIO ES DE: %d
%",p2);
printf("\nEL PORCENTAJE DE PERSONAS QUE ALCANZO EL GRADO SUPERIOR ES DE: %d
%",p3);
getch();

/*CALCULAR EL PROMEDIO DE LAS EDADES DE LAS PERSONAS CON NIVEL SUPERIOR*/


suma1=0;
a=0;
p1=0;
for(i=0;i<x;i++)
{
if(EDU[i]==3)
{
a++;
suma1=suma1+EDAD[i];
}
}
p1=suma1/a;
printf("\n\nEL PROMEDIO DE LAS EDAD DE LAS PERSONAS CON NIVEL SUPERIOR ES DE:
%d",p1);
getch();

getch();
}

Potrebbero piacerti anche