Advertisement
Nannoka

vetor

Jul 16th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4. int main (){
  5.  
  6.     float vet1[30];
  7.     int i;
  8.  
  9.     for (i=0; i<30 ;i++){
  10.         printf ("\nDigite 1 numero:  ");
  11.         scanf ("%f",&vet1[i]);
  12.     }
  13.  
  14.     for (i=0; i<30 ;i++){
  15.         if (i % 2 == 0){
  16.          
  17.             vet1[i] = vet1[i] * 1.02;
  18.         }
  19.         else{
  20.             //impar
  21.             vet1[i] = vet1[i] * 1.05;
  22.         }
  23.     }
  24.  
  25.     printf("\n\nVetor alterado:\n\n");
  26.  
  27.     for (i=0; i<30 ;i++){
  28.         printf ("Vet1[%i] = %.2f \n", i, vet1[i]);
  29.     }
  30.  
  31.  
  32.      system ("pause");
  33.      return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement