Paisen

Ran_cuad

Sep 27th, 2020
779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.51 KB | None | 0 0
  1. /*4) Realizar un programa que defina un vector llamado “vector_numeros” de 10 enteros,
  2. a continuación lo inicialice con valores aleatorios (del 1 al 10) y posteriormente
  3. muestre en pantalla cada elemento del vector junto con su cuadrado y su cubo.*/
  4. #include<stdio.h>
  5. #include<stdlib.h>
  6. #include<time.h>
  7.  
  8. int V[10],i;
  9.  
  10. int main (){
  11.     srand(time(NULL));
  12.     for(i=0; i<10; i++){
  13.         V[i]=1+rand()%10;
  14.        
  15.         printf("El numero:%d y su cuadrado:%d\n",V[i],(V[i]*V[i]));
  16.     }
  17.    
  18.    
  19.    
  20.     system("pause");
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment