Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

The closest in between

int num;
  
  int x;
  
  printf("Enter the total number of our men: ");
  scanf("%d", &num);
  
  int men[num];
  int n,n1;
  
  for(x=1; x<=num; x++){
  	
  
  printf("Men #%d: ", x);
  scanf("%d", &men[x]);
  
  //if(x>=num+1)
  
  }
  
  printf("Enemy #1: ");
  scanf("%d",&n);
  
  printf("Enemy #2: ");
  scanf("%d",&n1);  
  
   printf("
Men Cornered:
");
  
  for(x=1; x<=num; x++){
  	
  if(men[x]<=n1 && men[x]>=n){
    
   
    printf("%d ",men[x]);
  
  }}
Source by app.codechum.com #
 
PREVIOUS NEXT
Tagged: #The #closest
ADD COMMENT
Topic
Name
5+5 =