C program for printing random number.

Posted by Mangesh on June 17, 2018

program in c to generate the random number.

Program :

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main() 
{
  int i, n;
  printf("Five random numbers between 1 and 100\n");
  for (i = 1; i <= 5; i++)
  {
     n = rand()%100 + 1;
     printf("%d\n", n);
  }
  getch();
}

Output :

c program for random number Executed and Tested in Turbo C 3.2

Written with from Mangesh.

Related Post
1 C program to get date.
2 C program for Hello World.
3 C program to swap two number without third extra variable.
4 C program to find square root of a number.
5 C program for printing random number.
Latest Post
1 shubhanshu
2 test
3 C program for Breadth First Search.
4 C program for Depth First Search(DFS).
5 C for circular queue using linked list.