Advertisement
Guest User

1.c

a guest
Oct 21st, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2.  
  3. int main () {
  4.  
  5.  
  6.     int element;
  7.     printf("How many element you want?\n");
  8.     scanf("%d",&element);
  9.     int a[element];
  10.     int x,i,j,o,got = 0;
  11.     printf("What is your expected Sumation?\n");
  12.     scanf("%d",&x);
  13.  
  14.     printf("please insert array elements here \n");
  15.  
  16.     for (o = 0; o < element; o++) {
  17.         scanf("%d",&a[o]);
  18.     }
  19.  
  20.     for (i=0; i < (element - 1); i++) {
  21.  
  22.             for (j = (i+1); j < element; j++) {
  23.  
  24.                    if ( x == (a[i] + a[j]) ) {
  25.                         got = 1;
  26.                    }
  27.  
  28.             }
  29.     }
  30.  
  31.  
  32.     if (got == 1) {
  33.  
  34.         printf("Exists");
  35.  
  36.         } else {
  37.  
  38.         printf("NONE");
  39.     }
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement