LegoDrifter

Nizi - 6

Nov 18th, 2020
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3.  
  4. int main()
  5. {
  6.     int n,k,niza[100],ctr=0,brojnizi;
  7.     scanf("%d",&brojnizi);
  8.     for(int i=0;i<brojnizi;i++)
  9.     {
  10.         scanf("%d",&n);
  11.         for(int j=0;j<n;j++)
  12.         {
  13.             scanf("%d",&niza[j]);
  14.         }
  15.         for(int j=0;j<n;j++)
  16.         {
  17.             if(niza[j]==niza[n-j-1])
  18.             {
  19.                 ctr++;
  20.             }
  21.         }
  22.         printf("%.2f%\n",(float)ctr/n*100);
  23.         ctr=0;
  24.     }
  25.    
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment