Search

Program of Random Number in C || C Programs

Code -

#include <stdio.h>     
#include <conio.h> 
#include <stdlib.h> 
void main()  
{     
 // use rand() function to generate the number 
    printf (" The random number is: %d", rand());  
    printf ("\n The random number is: %d", rand());  
 
    printf (" \n The random number is: %d", rand());  
    printf ("\n The random number is: %d", rand());  
    getch();  
}  

Output -

The random number is: 41
 The random number is: 18467
 The random number is: 6334
 The random number is: 26500
4 views0 comments

Related Posts

See All

Getchar() function in C || C Programs

Code - #include <stdio.h> #include <conio.h> void main() { char c; printf ("\n Enter a character \n"); c = getchar(); // get a single character printf(" You have passed ")

GCD of two numbers in C || C Programs

Code - #include <stdio.h> #include <conio.h> int main() { // declare the variables int n1, n2, i, GCD_Num; printf ( " Enter any two numbers: \n "); scanf ( "%d %d", &n1, &n2);

  • 1024px-Telegram_logo.svg
  • download
  • YouTube