Write program to guess a random number seeded by current time.

A random number is generated to make the guessing game more interesting.

#include <stdio.h> #include <stdlib.h> #include <time.h> int main()//from ww w . j a v a 2 s.com { int r,guess; srand((unsigned)time(NULL)); r=rand(); printf("Can you guess the secret number: "); scanf("%d",&guess); if(guess==r) { puts("You guessed it!"); return(0); } if(guess!=r) { puts("Wrong!"); printf("The secret number was %d\n",r); return(1); } }

- Mathematical Functions
- Generating Pseudo-Random Integers
- Exploring common math functions
- Show Trigonometry sin graph
- Show Trigonometry cosine wave
- Generate random number with rand() function
- Seed the random numbers
- Seed the random numbers using current time