SHARE
TWEET

Untitled

a guest Feb 21st, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void) {
  5.    int n=0,i,count=0;
  6.    int *i_morreu;
  7.    int *r;
  8.    r = malloc(sizeof(int));
  9.    i_morreu = malloc(sizeof(int));
  10.    
  11.    printf("Digite a quantidade de mergulhadores");
  12.    scanf("%d",&n);
  13.     for (i=0; i<n; i++) {
  14.       printf("Digite o numero do mergulhador");
  15.       scanf("%d",&r[i]);
  16.     }
  17.  
  18.   for (i=0; i<n; i++) {
  19.       if (r[i] == 0) {
  20.         i_morreu[i] = i;
  21.         printf("\n o cara que morreu foi %d",i_morreu[i]+1);
  22.       }
  23.       count += i_morreu[i];
  24.     }
  25.  
  26.   if (count == 0) {
  27.     printf("\n ninguem morreu  *****");
  28.  
  29.   }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top