#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
int main(){
int n;
int i = 0, j = 0;
int a[4][4] = { { 1, 2, 8, 9 }, { 2, 4, 9, 12 }, { 4, 7, 10, 13 }, { 6, 8, 11, 15 } };
printf("please input the number that you want to find:");
scanf("%d", &n);
for (j = 3; j >-1; j--){
if (n >=a[0][j]){
break;
}
}
for (i = 3; i >-1; i--){
if (n >= a[i][j]){
break;
}
}
if (a[i][j] == n)
printf("true");
else
printf("false");
}
数组练习
最新推荐文章于 2024-04-27 19:42:34 发布