C Program to solve Dining philosophers problem.

Write a C Program to solve Dining philosophers problem.
Dining philosophers problem is a classic synchronization problem.A problem introduced by Dijkstra concerning resource allocation between processes. Five silent philosophers sit  around table with a bowl of spaghetti. A fork is placed between each pair of adjacent philosophers.

Each philosopher must alternately think and eat.
Eating is not limited by the amount of spaghetti left: assume an infinite supply.
However, a philosopher can only eat while holding both the fork to the left and the fork to the right
(an alternative problem formulation uses rice and chopsticks instead of spaghetti and forks).

Each philosopher can pick up an adjacent fork, when available, and put it down, when holding it.
These are separate actions: forks must be picked up and put down one by one.
The problem is how to design a discipline of behavior (a concurrent algorithm) such that each philosopher won’t starve, i.e. can forever continue to alternate between eating and thinking.
Read more about C Programming Language.

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include<stdio.h>
#include<semaphore.h>
#include<pthread.h>

#define N 5
#define THINKING 0
#define HUNGRY 1
#define EATING 2
#define LEFT (ph_num+4)%N
#define RIGHT (ph_num+1)%N

sem_t mutex;
sem_t S[N];

void * philospher(void *num);
void take_fork(int);
void put_fork(int);
void test(int);

int state[N];
int phil_num[N]={0,1,2,3,4};

int main()
{
int i;
pthread_t thread_id[N];
sem_init(&mutex,0,1);
for(i=0;i<N;i++)
sem_init(&S[i],0,0);
for(i=0;i<N;i++)
{
pthread_create(&thread_id[i],NULL,philospher,&phil_num[i]);
printf("Philosopher %d is thinkingn",i+1);
}
for(i=0;i<N;i++)
pthread_join(thread_id[i],NULL);
}

void *philospher(void *num)
{
while(1)
{
int *i = num;
sleep(1);
take_fork(*i);
sleep(0);
put_fork(*i);
}
}

void take_fork(int ph_num)
{
sem_wait(&mutex);
state[ph_num] = HUNGRY;
printf("Philosopher %d is Hungryn",ph_num+1);
test(ph_num);
sem_post(&mutex);
sem_wait(&S[ph_num]);
sleep(1);
}

void test(int ph_num)
{
if (state[ph_num] == HUNGRY && state[LEFT] != EATING && state[RIGHT] != EATING)
{
state[ph_num] = EATING;
sleep(2);
printf("Philosopher %d takes fork %d and %dn",ph_num+1,LEFT+1,ph_num+1);
printf("Philosopher %d is Eatingn",ph_num+1);
sem_post(&S[ph_num]);
}
}

void put_fork(int ph_num)
{
sem_wait(&mutex);
state[ph_num] = THINKING;
printf("Philosopher %d putting fork %d and %d downn",ph_num+1,LEFT+1,ph_num+1);
printf("Philosopher %d is thinkingn",ph_num+1);
test(LEFT);
test(RIGHT);
sem_post(&mutex);
}
Read more Similar C Programs
C Basic

Search Algorithms.

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

C Program to demonstrate dynamic memory allocation example.

Write a C Program to demonstrate dynamic memory allocation example.
Dynamic memory allocation means you can allocate or relocate (manipulate) the memory at the run time, using malloc, calloc, and realloc functions.
Using malloc, We can allocate block of memory for a variable
Using calloc function, We can allocate multiple blocks of memory for a variable.
We can alter, reassign the allocated memory using the realloc function.
We can releasing the allocated memory using the free function. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/



#include<stdio.h>
#include<stdlib.h>

int main() {
int* grades;
int sum = 0, i, numberOfStudents;
float average;


printf("Enter the number of students: ");
scanf("%d", &numberOfStudents);
getchar();

if((grades = (int*) malloc(numberOfStudents * sizeof(int))) == NULL) {
printf("nError: Not enough memory to allocate grades arrayn");
exit(1);
}

printf("nEnter the grades of %d students (in separate lines):n", numberOfStudents);

for(i = 0; i < numberOfStudents; i++) {
scanf("%d", &grades[i]);
getchar();
}

/* calculate sum */
for(i = 0; i < numberOfStudents; i++)
sum += grades[i];

/* calculate the average */
average = (float) sum / numberOfStudents;

printf("nThe average of the grades of all students is %.2f",
average);

getchar();
return(0);
}

Read more Similar C Programs
Learn C Programming

Number System

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

C Program to demonstrate isalpha, isdigit, is space.

C Program to demonstrate the following functions:isalpha, isdigit, isspace.The same principles apply to isalnum, iscntrl, isgraph,islower, isprint, ispunct, isupper, isxdigit.
In the standard library ctype.h all the above functions are declared.
All the subroutines mentioned here, returns non zero(true), If the checked argument is true for the respective subroutines. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include <stdio.h> /* printf */
#include <ctype.h> /* isalpha isdigit isspace etc */

#define FALSE 0
#define TRUE 1

/* function declarations */
int char_type(char);

main()
{
char ch;
/* get a character from the keyboard */
printf(" Please enter a charcater => ");
ch = getc(stdin);

char_type(ch); /* Figure out the character type */


}

//char_type:decides the character type
int char_type(char ch)
{
/* returns non zero if A-Z or a-z */
if ( isalpha(ch) != FALSE)
printf("%c is an Alpha character.n",ch);

/* returns non zero if 0-9 */
if ( isdigit(ch) != FALSE)
printf("%c is a numeric character.n",ch);

/* returns non zero if a space, CR, Tab, NL FF */
if ( isspace(ch) != FALSE)
printf("%c is white spacen", ch);

}

Read more c programs 
C Basic
C Strings

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

K & R C Programs Exercise 7-2.

K and R C, Solution to Exercise 7-2:
K and R C Programs Exercises provides the solution to all the exercises in the C Programming Language (2nd Edition). You can learn and solve K&R C Programs Exercise.
Write a program that will print arbitrary input in a sensible way. As a minimum, it should print non-graphic characters in octal or hexadecimal according to local custom, and break long text lines. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include <stdio.h>
#define OCTAL 8
#define HEXADECIMAL 16


void ProcessArgs(int argc, char *argv[], int *output)
{
int i = 0;
while(argc > 1)
{
--argc;
if(argv[argc][0] == '-')
{
i = 1;
while(argv[argc][i] != '')
{
if(argv[argc][i] == 'o')
{
*output = OCTAL;
}
else if(argv[argc][i] == 'x')
{
*output = HEXADECIMAL;
}

++i;
}
}
}
}

int can_print(int ch)
{
char *printable = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 !"#%&'()*+,-./:;<=>?[\]^_{|}~tfvrn";

char *s;
int found = 0;

for(s = printable; !found && *s; s++)
{
if(*s == ch)
{
found = 1;
}
}

return found;
}

int main(int argc, char *argv[])
{
int split = 80;
int output = HEXADECIMAL;
int ch;
int textrun = 0;
int binaryrun = 0;
char *format;
int width = 0;

ProcessArgs(argc, argv, &output);

if(output == HEXADECIMAL)
{
format = "%02X ";
width = 4;
}
else
{
format = "%3o ";
width = 4;
}

while((ch = getchar()) != EOF)
{
if(can_print(ch))
{
if(binaryrun > 0)
{
putchar('n');
binaryrun = 0;
textrun = 0;
}
putchar(ch);
++textrun;
if(ch == 'n')
{
textrun = 0;
}

if(textrun == split)
{
putchar('n');
textrun = 0;
}
}
else
{
if(textrun > 0 || binaryrun + width >= split)
{
printf("nBinary stream: ");
textrun = 0;
binaryrun = 15;
}
printf(format, ch);
binaryrun += width;
}
}

putchar('n');

return 0;
}

Read more c programs

C Basic
C Strings
K and R C Programs Exercise

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

K & R C Programs Exercise 5-19.

K and R C, Solution to Exercise 5-19:
K and R C Programs Exercises provides the solution to all the exercises in the C Programming Language (2nd Edition). You can learn and solve K&R C Programs Exercise.
C Program to modify(K & R C Programs Exercise 5-18.) undcl so that it does not add redundant parentheses to declarations. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include<stdio.h>
#include<string.h>
#include<ctype.h>

#define MAXTOKEN 100

enum { NAME, PARENS, BRACKETS};
enum { YES, NO};



int gettoken(void);
int nexttoken(void);
extern int tokentype;
extern char token[MAXTOKEN];
char out[1000];
extern int prevtoken = NO;
//UNDCL:convert word description to declaration
main()
{
int type;
char temp[MAXTOKEN];
while (gettoken() !=EOF) {
strcy(out, token);
while ((type = gettoken()) != 'n')
if(type == PARENS || type == BRACKETS)
strcat(out, token);
else if(type == '*') {
if((type = nexttoken()) == PARENS || type == BRACKETS)
sprintf(temp, "(*%s)", out);
else
sprintf(temp, "*%s", out);
strcpy(out, temp);

}else if(type == NAME){
sprintf(temp, "%s%s",token, out);
strcpy(out, temp);
}else
printf("Invalid input at %sn",token);
printf("%sn",out);
}
return 0;
}


//nexttoken: get the next token and push it back
int nexttoken(void)
{
int type;
extern int prevtoken;
type = gettoken();
prevtoken = YES;
return type;
}


//get token:return next token
int gettoken(void)
{
int c, getch(void);
void ungetch(int);
char *p = token;
if(prevtoken == YES) {
prevtoken = NO;
return tokentype;
}
while((c = getch()) == ' ' || c == 't')
;
if(c == '('){
if ((c = getch()) == ')'){
strcpy(token,"()");
return tokentype = PARENS;
}
else{
ungetch(c);
return tokentype = '(';
}
}
else if(c == '['){
for(*p++ = c; (*p++ = getch()) != ']';)
;
*p = '';
return tokentype = BRACKETS;
}
else if (isalpha(c)) {
for(*p++ = c; isalnum(c = getch());)
*p++ = c;
*p = '';
ungetch(c);
return tokentype = NAME;
} else
return tokentype = c;
}


Read more c programs
C Basic
C Strings
K and R C Programs Exercise

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

K & R C Programs Exercise 5-15.

K and R C, Solution to Exercise 5-15:
K and R C Programs Exercises provides the solution to all the exercises in the C Programming Language (2nd Edition). You can learn and solve K&R C Programs Exercise.
C program to add the option -f to fold upper and l;ower case together, so that case distinctions are not made during sorting; for example, c and C compare equal. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include<stdio.h>
#include<string.h>
#include<ctype.h>


#define NUMERIC 1
#define DECR 2
#define FOLD 4
#define LINES 100
int charcmp(char *, char *);
int numcmp(char *, char *);
int readlines(char *lineptr[], int maxlines);
void qsort(char *v[], int left, int right, int (*cmp)(void *, void *));
void write lines(char *lineptr[], int nlines, int order);
static char option = 0;
// sort input lines
main(int argc, char *argv[])
{
char *lineptr[LINES];
int nlines;
int c, rc = 0;
while(--argc > 0 && (*++argv)[0] == '-')
while(c = *++argv[0]
switch(c) {

case 'f':
option != FOLD;
break;
case 'n':
option != NUMERIC;
break;
case 'r':
option != DECR;
break;
default:
printf("sort: illigal option %cn",c);
argc = 1;
rc = -1;
break;
}
if(argc)
printf("Usage:sort -dfnr n");
else{
if(nlines = readlines(lineptr, LINES)) > 0){
if(option & NUMERIC)
qsort((void **) lineptr, 0, nlines-1,(int (*)(void *, void *)) numcmp);
else
qsort((void **) lineptr, 0, nlines-1,(int (*)(void *, void *)) charcmp);
writelines(lineptr, nlines, option & DECR);
} else {
printf("input too big to sortn");
rc = -1;
}
}
return rc;
}


/*charcmp: return < 0 if s<t, 0 if s==t,>0 if s>t */
int charcmp(char *s, char *t)
{
for(; tolower(*s) == tolower(*t);s++,t++)
if(*s == '')
return 0;
return tolwer(*s) - tolower(*t);
}


//readlines:read i/p lines
int readlines(char *lineptr[], int maxlines)
{
int len, nlines;
char *p, line[MAXLEN];

nlines = 0;
while ((len = getline(line, MAXLEN)) > 0)
if (nlines >= maxlines || (p = malloc(len)) == NULL)
return -1;
else {
line[len - 1] = '';
strcpy(p, line);
lineptr[nlines++] = p;
}
return nlines;
}

//writeline:write output lines
void writelines(char *lineptr[], int nlines)
{
int i;

for (i = 0; i < nlines; i++)
printf("%sn", lineptr[i]);
}


//cnumcmp:ompare p1 and p2 numerically
int numcmp(const void *p1, const void *p2)
{
char * const *s1 = reverse ? p2 : p1;
char * const *s2 = reverse ? p1 : p2;
double v1, v2;

v1 = atof(*s1);
v2 = atof(*s2);
if (v1 < v2)
return -1;
else if (v1 > v2)
return 1;
else
return 0;
}

/*qsort: sort v[left]....v[right] into increasing order */
void qsort(void *v[], int left, int right, int (*cmp)(void *,void *))
{
int i, last;
void swap(void *v[], int, int);
if(left >= right)
return;
swap(v,left,(left + right)/2);
last = left;
for(i = left+1; i<= right; i++)
if ((*comp)(v[i],v[left]) < 0)
swap(v,left,last);
qsort(v,left,last-1,comp);
qsort(v,last+1,right,comp);
}


void swap(void *v[], int i, int j)
{
void *temp;
temp = v[i];
v[i] = v[j];
v[j] = temp;
}
Read more c programs
C Basic
C Strings
K and R C Programs Exercise

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

C Program to demonstrate strpbrk function.

Write C programt to demonstrate strpbrk function.
strpbrk function locate the first occurrence pointed by the of string s1 from the string pointed to by s2. In this program, We Turns miscellaneous field separators into just a space separating tokens for easy parsing by SSCANF. Eventually, the character separators and replacement character will be passed in as strings. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/
#include <stdio.h>
#include <string.h>
#include <strings.h>

#define LINE_BUF 100

void find_comment(char *);

main()
{
char line[LINE_BUF];
char *sep;
int var1, var2;

while (fgets(line, LINE_BUF, stdin)) {

/*
* Check this out: Since SEP is a pointer to type char, when line is
* assigned to sep, really the first address is assigned to sep. LINE
* is the address of the start of the string. In contrast, LINE[0]
* is the first character of the string.
*/

sep = line;

while (sep != 0) {
sep = strpbrk(line, ";.&:,");
if (sep != 0)
*sep = ' ';
}
fputs(line, stdout);
}
return 0;
}
Read more c programs 
C Basic
C Strings

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

C Program to demonstrate sscanf statement.

C Program to demonstrate the ‘sscanf’ statement.
sscanf statement reads formatted data from the string, Different syntax of sscanf are:
A = sscanf(str, format)
A = sscanf(str, format, sizeA)
[A, count] = sscanf(…)
[A, count, errmsg] = sscanf(…)
[A, count, errmsg, nextindex] = sscanf(…).Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include <stdio.h>

main()
{
char Host[64];
char User[64];
char *Buff = "Jobname=job1 Hostname=arnamul User=leslim Time=11:15";
/* <----------> <-----> <---------> <-------->
* | | | |
* | ------------ | |
* | | ------------------ V
* | | | NULL
* V V V */
sscanf (Buff, "%*s Hostname=%s %s", Host, User);

printf("Host is %sn", Host);
printf("User is %sn", User);
exit(0);
}


Read more c programs 
C Basic
C Strings
K and R C Programs Exercise

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

C Program which produces its own source code as its output.

Write a c program which produces its own source code as its output.
This C program uses the C File i/o operations like fopen(), fclose(). In this program, We pritn the source code of the program.Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include<stdio.h>
int main()
{
FILE *fp;
char c;

fp = fopen(__FILE__,"r");

do{

c= getc(fp);

putchar(c);

}
while(c!=EOF);

fclose(fp);

return 0;

}


Read more Similar C Programs
C Basic

C File i/o

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

C Program to find the two sets Intersection and Union

Write a C Program to find the two sets Intersection and Union
A Set is a collection of well defined and distinct objects.
Intersection of two sets A and B is defined as, all the elements of set A, which are also elements of set B.Union of two sets A and B is defined as, all the elements of A and B, but not belonged to both.
Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

#include<stdio.h>
#include<conio.h>
void Union(int set1[10],int set2[10],int m,int n);
void Intersection(int set1[10],int set2[10],int m,int n);
void main()
{
int a[10],b[10],m,n,i,j;
int ch;
clrscr();
printf("nEnter the number of elements in first set:n");
scanf("%d",&m);
printf("nEnter the elements:n");
for(i=0;i<m;i++)
{
scanf("%d",&a[i]);
}
printf("nElement of First set:nn");
for(i=0;i<m;i++)
{
printf("%dt",a[i]);
}
printf("nEnter the number of elements in second set:n");
scanf("%d",&n);
printf("nEnter the elements:n");
for(i=0;i<n;i++)
{
scanf("%d",&b[i]);
}
printf("nElement of second setn");
for(i=0;i<n;i++)
{
printf("%dt",b[i]);
}
for(;;)
{
printf("nnMenunn1.Unionn2.Intersection");
printf("n3.exit");
printf("nEnter your choice:n");
scanf("%d",&ch);
switch(ch) {
case 1:
Union(a,b,m,n);
break;
case 2:
Intersection(a,b,m,n);
break;
case 3:
exit(0);
}
getch();
}
}

void Union(int a[10],int b[10],int m,int n)
{
int c[20],i,j,k=0,flag=0;
for(i=0;i<m;i++)
{
c[k]=a[i];
k++;
}
for(i=0;i<n;i++)
{
flag=0;
for(j=0;j<m;j++)
{
if(b[i]==c[j])
{
flag=1;
break;
}
}
if(flag==0)
{
c[k]=b[i];
k++;
}
}
printf("nElement of resultant setnn");
for(i=0;i<k;i++)
{
printf("t%d",c[i]);
}
}
void Intersection(int a[10],int b[10],int m,int n)
{
int c[20],i,j,k=0,flag=0;
for(i=0;i<m;i++)
{
flag=0;
for(j=0;j<n;j++)
{
if(a[i]==b[j])
{
flag=1;
break;
}
}
if(flag==1)
{
c[k]=a[i];
k++;
}
}
if(k==0)
{
printf("nnResultant set is null set!n");
}else{
printf("nElement of resultant setn");
for(i=0;i<k;i++)
{
printf("t%d",c[i]);
}
}
}


Read more Similar C Programs
Learn C Programming

Number System

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com