lundi 6 avril 2020

C Random Numbers

İt prints different number ,i supposed that we need to include time.h to print different numbers .Why did this happen like that ?

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

int main(){
  for(int i=0;i<5;i++){
    int goals[i]=(rand()%25)+1; 
  }
  for(int i=0;i<5;i++){
    printf("%d",goals[i]);
  }
}



Aucun commentaire:

Enregistrer un commentaire