Advertisement
Mastercpp

numero aleatorio1

Sep 19th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5.  
  6. int main(){
  7.     int x ,y;
  8.     srand(time(NULL)); // e
  9.     x = rand()%10+1;
  10.     //printf("%d",x);
  11.    
  12.    
  13.     printf("Adivina un numero: ");
  14.     scanf("%d",&y);
  15.    
  16.     if(x == y){
  17.         printf("numero adivinado\n");
  18.     }
  19.     else printf("pierdes\n");
  20.    
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement