C-Programming Tutorials

C Program to Generate Random Numbers

This C program generates numbers randomly using random function.

In this program for loop is used to call rand() function multiple times.

Program:

#include <stdio.h>

#include <stdlib.h>

int main()

{

    int c, n;

    printf("Ten random numbers in [1,100]\n");

   

    for (c = 1; c <= 10; c++)

    {   

        n = rand()%100 + 1;

        printf("%d\n", n);   

    }

   

    return 0;

}

C Program to Add n Number of Times (Prev Lesson)
(Next Lesson) C Program to Check whether the Given Number is a Palindromic or Not
Back to C-Programming Tutorials
Notice: compact(): Undefined variable: limits in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!