Skip to content

Instantly share code, notes, and snippets.

@luishurtado
Forked from narenpertuz/Ejercicio.cpp
Created May 20, 2021 21:36
Show Gist options
  • Save luishurtado/a97c5166ff9a76eb564f4292aa2ab568 to your computer and use it in GitHub Desktop.
Save luishurtado/a97c5166ff9a76eb564f4292aa2ab568 to your computer and use it in GitHub Desktop.
Prueba tecnica de Naren Pertuz Vides para Kommit
// Por favor digitar valores de tipo Float. Ejemplo: 1.2
// Naren Pertuz Vides - Ingeniero de sistemas
#include<stdio.h>
#include<stdlib.h>
int main(){
float coord;
float v1[28] = {0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 1.7, 2.7, 3.7, 4.7, 5.7, 6.7,
7.7, 7.6, 7.5, 7.4, 7.3, 7.2, 7.1, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0};
float v2[20] = {1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.6, 3.6, 4.6, 5.6, 6.6,
6.5, 6.4, 6.3, 6.2, 6.1, 5.1, 4.1, 3.1, 2.1};
float v3[12] = {2.2, 2.3, 2.4, 2.5, 3.5, 4.5, 5.5, 5.4, 5.3, 5.2, 4.2, 3.2};
float v4[4] = {3.3, 3.4, 4.4, 4.3};
printf("INGRESE LA COORDENADA DE UBICACION DE LA DAMA [i.j]\n");
printf("NOTA: Digite valores de tipo Float. Ejemplo: 1.2 \n\n");
printf("Digite valor: ");
scanf("%f",&coord);
for(int i=0; i<28; i++){
if(v1[i]==coord){
printf("\nEl total de casillas que la dama puede atacar es 21");
return 0;
}
}
for(int i=0; i<20; i++){
if(v2[i]==coord){
printf("\nEl total de casillas que la dama puede atacar es 23");
return 0;
}
}
for(int i=0; i<12; i++){
if(v3[i]==coord){
printf("\nEl total de casillas que la dama puede atacar es 25");
return 0;
}
}
for(int i=0; i<4; i++){
if(v4[i]==coord){
printf("\nEl total de casillas que la dama puede atacar es 27");
return 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment