Here are a few simple programs for beginners!!
Basic Hello World:
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
Guess the Number (note the random seed is being set to the current system time):
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
int range,num, guessnum, tries;
printf("Upper Range PIease: ");
scanf("%d",&range);
srand(time(0));
num = (rand() % range) + 1;
while (guessnum != num)
{
printf("Enter a Number: ");
scanf("%d", &guessnum);
tries = tries + 1;
if (guessnum < num)
{
printf("Too low\n");
}
if (guessnum > num)
{
printf("Too high\n");
}
}
printf("You guessed it\n");
return 0;
}