Advertisement
lukibeni

sodi

Nov 1st, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. typedef struct koordinatak{
  4.     char a,b;
  5.     int c,d;
  6.     } koordinatak;
  7.  
  8. int kiralylepesek(koordinatak a){
  9.  
  10.     if (fabs(a.a-a.b) <= 1 && fabs(a.c-a.d) <=1) return 1;
  11.     else return 0;
  12.  
  13. }
  14.  
  15. int main(){
  16.  
  17.     koordinatak a;
  18.  
  19.     printf("Kerem a szamot: ");
  20.     scanf("%c %d %c %d", &a.a,&a.c,&a.b,&a.d);
  21.  
  22.     if (kiralylepesek(a)) printf("Helyes.");
  23.     else printf("Helytelen.");
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement