Become Our Fan on Social Sites!

Facebook Twitter

Google+ RSS YouTube

Tuesday 1 October 2013

Generate random number using C language

Random number: Random number is a number generated by rand() function of stdlib.h header file. This function is used to generate random number in particular range. For example  random number range like 90 to 110.
 

 #include<stdio.h>  
 #include<stdlib.h>  
 void main()  
 {  
   int no;  
   clrscr();  
   srand(time(NULL));  
   // rand() % total_no + start_no  
   no = rand() % 20 + 90;  
   printf("\n%d",no);  
   getch();  
 }  

0 comments :

Post a Comment