Язык СИ:
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<time.h>
int main(){
srand(time(0));
const long double cbc=64.0L-FLT_EPSILON;
unsigned short int r1=cbc/RAND_MAX*rand(),
r2=cbc/RAND_MAX*rand();
printf("R1: %c%c\n",65+r1%8,49+r1/8);
printf("R2: %c%c\n",65+r2%8,49+r2/8);
printf("%s\n",r1%8==r2%8 || r1/8==r2/8?"yes":"no");
return 0;
}
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Язык СИ:
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<time.h>
int main(){
srand(time(0));
const long double cbc=64.0L-FLT_EPSILON;
unsigned short int r1=cbc/RAND_MAX*rand(),
r2=cbc/RAND_MAX*rand();
printf("R1: %c%c\n",65+r1%8,49+r1/8);
printf("R2: %c%c\n",65+r2%8,49+r2/8);
printf("%s\n",r1%8==r2%8 || r1/8==r2/8?"yes":"no");
return 0;
}