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 C program to implement Queue using linked list.
2 C program for binary search tree (BST).
3 C program to search an element in linked list.
4 C program for postorder traversal in binary tree.
5 C program for preorder traversal in binary tree.