C Program to generate random numbers


This content was proof-read by Grammarly. You can Try Grammary for FREE

Problem Statement

Write a program in C to generate 10 random number between 1 and 100.

C Program to generate random numbers 

#include <stdio.h> 
#include <stdlib.h> 
int main()  
{ 
        int i, n; 
        printf("10 random numbers between 1 and 100\n"); 
    
        for (i = 1; i <= 10; i++)  
        { 
             n = rand()%100 + 1; 
             printf("%d\n", n); 
        } 
        return 0; 
}
Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

%d bloggers like this: