C Program to illustrate Arithmetic operators

C Program to illustrate Airthmatic operators. This program takes an integer variable i and performs the basic arithmetic functions like Addition, Subtraction, Multiplication, Division, Unary Addition and Unary Subtraction. 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()
{

 int i;

 i = 5;
 printf("The Value of i is : %d", i);
 i = i  + 5;
 printf("nThe Value of i is : %d", i);
 i = i - 2;
 printf("nThe Value of i is : %d", i);
 i = i  * 2;
 printf("nThe Value of i is : %d", i);
 i = i / 4;
 printf("nThe Value of i is : %d", i);
 i++;
 printf("nThe Value of i is : %d", i);
 i++;
 printf("nThe Value of i is : %d", i);
 i --;
 printf("nThe Value of i is : %d", i);

 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!

(c) www.c-program-example.com

C Program to Illustrate all data types.

C Program to Illustrate all data types.  The four different data types are assigned the corresponding values are printed. We can see that, to print a Integer value we give a %d sign, similarly for Character %c, Float %f and for Double %e.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()
{
int sum;
float money;
char letter;
double pi;

sum = 10; /* assign integer value*/
money = 2.21; /* assign float value*/
letter = 'A'; /* assign character value */
pi = 2.01E6; /* assign a double value */

printf("value of sum = %dn", sum );
printf("value of money = %fn", money );
printf("value of letter = %cn", letter );
printf("value of pi = %en", pi );
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!

(c) www.c-program-example.com

C Program to print the values stored in identifiers.

C Program to print the values stored in identifiers. An identifier can be in lowercase or uppercase. The upper and lower case are NOT interchangeable. The above program should give you an idea that C is case sensitive. “Sum” and “sum” are different variables and so have different values. The _ (underscore) character can also be included and is considered a letter. So try a program by using some other identifiers using underscore. 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()
{
int sum, Sum ;

sum = 10 ;
Sum = 20;

printf(" The value stored in two different identifiers
are : ");

printf(" n sum is : %d n Sum is %d n", sum, Sum);

getchar();

return(0);
}
Read more Similar C Programs
Learn C Programming

Simple C Programs

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!

(c) www.c-program-example.com

C program to find the sparse matrix

C program to accept a matrix and determine whether it is a sparse matrix or not?. A sparse matrix is a matrix, which has more zero elements than nonzero elements. 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>

void main ()
{
static int m1[10][10];
int i,j,m,n;
int counter=0;

printf ("Enter the order of the matixn");
scanf ("%d %d",&m,&n);

printf ("Enter the co-efficients of the matixn");
for (i=0;i<m;++i)
{
for (j=0;j<n;++j)
{
scanf ("%d",&m1[i][j]);
if (m1[i][j]==0)
{
++counter;
}
}
}
if (counter>((m*n)/2))
{
printf ("The given matrix is sparse matrix n");
}
else
printf ("The given matrix is not a sparse matrix n");

printf ("There are %d number of zeros",counter);

} /* EN dof main() */
Read more Similar C Programs
Matrix Programs
Learn C Programming

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!

(c) www.c-program-example.com

C program to accept an integer find the sum of the digits in it

C program to accept an integer find the sum of the digits in it. In this program, we accept an integer and get the digits by using while() and % operator, after that we add that digits to the sum variable. 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>

void main()
{
long num, temp, digit, sum = 0;

printf("Enter the numbern");
scanf("%ld", &num);

temp = num;

while(num > 0)
{
digit = num % 10;
sum = sum + digit;
num /= 10;
}

printf("Given number =%ldn", temp);
printf("Sum of the digits %ld =%ldn", temp, sum);
} /* End of main()*/
Read more Similar C Programs
C Basic

Airthmatic Operators

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!

(c) www.c-program-example.com

C program to accept N numbers and arrange them in an descending order

C Sorting,
C program to accept N numbers and arrange them in an descending order. Program will accept the array of elements, and returns the elements in descending order. Program use the Bubble sort Technique to sort the Array. 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>

void main ()
{
int i,j,a,n,number[30];

printf ("Enter the value of Nn");
scanf ("%d", &n);

printf ("Enter the numbers n");
for (i=0; i<n; ++i)
scanf ("%d",&number[i]);

for (i=0; i<n; ++i)
{
for (j=i+1; j<n; ++j)
{
if (number[i] < number[j])
{
a= number[i];
number[i] = number[j];
number[j] = a;
}
}
}

printf ("The numbers arrenged in descending order are given belown");
for (i=0; i<n; ++i)
printf ("%dn",number[i]);
} /* End of main() */
Read more Similar C Programs
Array In C

Sorting Techniques

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!

(c) www.c-program-example.com

C Program to multiply given number by 4 using bitwise operators

C Program to multiply given number by 4 using bitwise operators. Bitwise operators allows to cahnge or edit the specific bits within an integer. Program will multiply a given number by 4 using left shift(<<) bitwise operator. 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
***********************************************************/

/* c program to multiply given number by 4 *
* using bitwise operators */

#include <stdio.h>

void main()
{
long number, tempnum;

printf("Enter an integern");
scanf("%ld",&number);
tempnum = number;
number = number << 2; /*left shift by two bits*/

printf("%ld x 4 = %ldn", tempnum,number);
}
Read more Similar C Programs
Array In C

Sorting Techniques

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!

(c) www.c-program-example.com

C Program to read an English sentence and replace lowercase characters by uppercase and vice-versa.

Write a C program to read an English sentence and replace lowercase characters by uppercase and vice-verso. Output the given sentence as well as the case converted sentence on two different 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>
#include <ctype.h>
#include <conio.h>

void main()
{
char sentence[100];
int count, ch, i;

clrscr();

printf("Enter a sentencen");
for(i=0; (sentence[i] = getchar())!='n'; i++)
{
;
}

sentence[i]='';

count = i; /*shows the number of chars accepted in a sentence*/

printf("The given sentence is : %s",sentence);

printf("nCase changed sentence is: ");
for(i=0; i < count; i++)
{
ch = islower(sentence[i]) ? toupper(sentence[i]) : tolower(sentence[i]);
putchar(ch);
}

} /*End of main()*/
Read more Similar C Programs

C Strings


Data Structures


C Sorting

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!

(c) www.c-program-example.com

C program to input real numbers and find the mean, variance and standard deviation

Write a C program to input real numbers and find the mean, variance and standard deviation.Mean is sum of values divided by the total number of values. Variance shows the how the data s are distributed. Standard deviation is the square root of its variance. 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>
#include <math.h>
#define MAXSIZE 10

void main()
{
float x[MAXSIZE];
int i, n;
float avrg, var, SD, sum=0, sum1=0;

clrscr();

printf("Enter the value of Nn");
scanf("%d", &n);

printf("Enter %d real numbersn",n);
for(i=0; i<n; i++)
{
scanf("%f", &x[i]);
}

/* Compute the sum of all elements */

for(i=0; i<n; i++)
{
sum = sum + x[i];
}
avrg = sum /(float) n;

/* Compute varaience and standard deviation */

for(i=0; i<n; i++)
{
sum1 = sum1 + pow((x[i] - avrg),2);
}
var = sum1 / (float) n;
SD = sqrt(var);

printf("Average of all elements = %.2fn", avrg);
printf("Varience of all elements = %.2fn", var);
printf("Standard deviation = %.2fn", SD);
} /*End of main()*/
Read more Similar C Programs
Array In C

Simple C Programs

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!

(c) www.c-program-example.com

C program to find the sum of ‘N’ natural numbers.

Write a C program to find the sum of ‘N’ natural numbers. Natural numbers are the whole numbers except zero, usually we used for counting.
Example:1, 2, 3, 4,———– 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 main()
{
int i, N, sum = 0;

clrscr();

printf("Enter an integer numbern");
scanf ("%d", &N);

for (i=1; i <= N; i++)
{
sum = sum + i;
}

printf ("Sum of first %d natural numbers = %dn", N, sum);
}
Read more Similar C Programs
Searching in C

Number Theory 
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!

(c) www.c-program-example.com