Advertisement
ppupil2

Q5-PRF192-PE-trial

Mar 26th, 2020
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <math.h>
  5.  
  6.  
  7. int main() {
  8.   system("cls");
  9.   //INPUT - @STUDENT:ADD YOUR CODE FOR INPUT HERE:
  10.     int x, y;
  11.     int a[100];
  12.     int check = 1;
  13.    
  14.     scanf("%d", &x);
  15.    
  16.     for (int i = 0; i<x; i++) {
  17.         scanf("%d", &a[i]);
  18.     }
  19.    
  20.     y = x/2;
  21.     for (int i = 0; i<= y; i++) {
  22.         if (a[i] != a[x-1-i]) {
  23.             check = 0;
  24.             break;
  25.         }
  26.     }
  27.  
  28.   // Fixed Do not edit anything here.
  29.   printf("\nOUTPUT:\n");
  30.   //@STUDENT: WRITE YOUR OUTPUT HERE:
  31.     printf("%d", check);
  32.  
  33.   //--FIXED PART - DO NOT EDIT ANY THINGS HERE
  34.   printf("\n");
  35.   system ("pause");
  36.   return(0);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement