bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

luc056.c (1085B)


      1 /*
      2  * Author  : Amit Dutta <amitdutta4255@gmail.com>
      3  * Date    : 08 Feb 2026
      4  * Repo    : https://github.com/notamitgamer/bsc
      5  * License : MIT License (See the LICENSE file for details)
      6  */
      7 
      8 /* If an array arr contains n elements, then write a program to check if arr[0] = arr[n-1], arr[1] = arr[n-2] and so on.
      9 */
     10 
     11 /* Let Us C, Chap- 13 (Arrays), Qn No.: B(b) */
     12 
     13 /* This file is auto-generated by a bot. */
     14 /* This code is not compiled; it is for reference only. */
     15 
     16 
     17 #include <stdio.h>
     18 #include <math.h>
     19 #include <stdlib.h>
     20 
     21 int main()
     22 {
     23     int arr[100], n, i, symmetric = 1;
     24 
     25     printf("Enter number of elements (n): ");
     26     scanf("%d", &n);
     27 
     28     printf("Enter %d elements: ", n);
     29     for (i = 0; i < n; i++)
     30     {
     31         scanf("%d", &arr[i]);
     32     }
     33 
     34     // Check symmetry
     35     for (i = 0; i < n / 2; i++)
     36     {
     37         if (arr[i] != arr[n - 1 - i])
     38         {
     39             symmetric = 0;
     40             break;
     41         }
     42     }
     43 
     44     if (symmetric)
     45         printf("\nThe array is symmetric (Palindrome).\n");
     46     else
     47         printf("\nThe array is NOT symmetric.\n");
     48 
     49     return 0;
     50 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror