In this post, we will see a C program to convert temperature from Celsius(°C) to Fahrenheit(°F) The program accepts the temperature value in °C  from user and convert its value equivalent to °F and display the result on the screen. Step 1: Start Step 2: Read the temperature value in Celcuis Step… Continue Reading C PROGRAM TO CONVERT TEMPERATURE (CELSIUS TO FAHRENHEIT)

C PROGRAM TO FIND COUNT OF DUPLICATE ELEMENTS IN AN ARRAY In this post we will see a simple C program to find the count of duplicate elements in an Array. In below program we will get the count of elements that are duplicated i.e. elements that are occurred more… Continue Reading C Program to count duplicate / repeated elements in an array

In this article we will see how to compile a C Program with Visual Studio Command Prompt. Here i am using Visual studio 2010. For opening Visual Studio command prompt, All Programs -> Microsoft visual Studio 2010 -> Visual Studio Tools -> Visual Studio command prompt   After opening command… Continue Reading Compiling a C program with Visual Studio Command Prompt

  #include<stdio.h> int main() { int x,y; printf(” **** www.ProgrammingPosts.com *** “); printf(” >>> PROGRAM TO ADD TWO NUMBERS WITHOUT USING THIRD VARIABLE <<< “); printf(“n Enter the first number to be added: “); scanf(“%d”,&x); /* taking x value from keyboard*/ printf(“n Enter the second number to be added: “);… Continue Reading C PROGRAM TO ADD TWO NUMBERS WITHOUT USING THIRD VARIABLE

C PROGRAM TO ADD TWO NUMBERS / INTEGERS USING FUNCTION #include<stdio.h> #include<conio.h> int sum(int,int); /*declaring prototype of function*/ void main() { int a,b,c; printf(“n Enter the two numbers : “); scanf(“%d %d”,&a,&b); /* taking two numbers as input*/ c = sum(a,b); /* calling function,                        *the value returned by the function… Continue Reading C PROGRAM TO ADD TWO NUMBERS USING FUNCTION

C PROGRAM TO FIND LARGEST / BIGGEST NUMBER IN ARRAY #include<stdio.h> #define MAX 25 //maximum size of array is 25 main() { int i,n,LargeNo,arr[MAX]; printf(“*** C PROGRAMS BLOG ***”); printf(“\n>>> Program to find Largest element in array <<<\n”); printf(“\n Enter the size of array: “); scanf(“%d”,&n); //taking size of array… Continue Reading C PROGRAM TO FIND LARGEST / BIGGEST NUMBER IN ARRAY

C PROGRAM TO CHECK WHETHER GIVEN YEAR IS LEAP YEAR OR NOT #include<stdio.h> void LeapYear(int); void main() { int year; printf(“\n *** C PROGRAMS BLOG *** \n”); printf(“\n >>>> C PROGRAM TO CHECK WHETHER GIVEN YEAR LEAP YEAR OR NOT <<<< \n”); printf(“\n Enter the year : “); scanf(“%d”,&year); LeapYear(year);… Continue Reading C PROGRAM TO CHECK WHETHER GIVEN YEAR IS LEAP YEAR OR NOT

C PROGRAM TO FIND ROOTS OF QUADRATIC EQUATION #include<stdio.h> #include<math.h> int main() { float a,b,c,x,y,disc,p,q,r; printf(“n *** C PROGRAMS BLOG ***”); printf(“n >>>> C PROGRAM TO FIND ROOTS OF QUADRATIC EQUATION <<<<“); printf(“n Enter the values of a,b,c : “); scanf(“%f %f %f”,&a,&b,&c); disc=(b*b)-(4*a*c); if(disc == 0) { x=(-b)/(2*a); y=x;… Continue Reading C PROGRAM TO FIND ROOTS OF QUADRATIC EQUATION

C PROGRAM EXAMPLE FOR toupper() FUNCTION : #include <stdio.h> //#include<string.h> int main() { int i; char str[20]; printf(“\n >>> C PROGRAM TO IMPLEMENT toupper() FUNCTION <<< \n”); printf( “\n Enter the string in Lower or Mixed Case: “); //scanf(“%s”,&str); //scanf() wont allow spaces gets(str); //gets() allows apaces printf(“\n The entered… Continue Reading C PROGRAM EXAMPLE FOR toupper() FUNCTION

C PROGRAM EXAMPLE FOR tolower() FUNCTION #include <stdio.h> //#include<string.h> int main() { int i; char str[20]; printf(“\n >>> C PROGRAM TO IMPLEMENT tolower() FUNCTION <<< \n”); printf(“\n Enter the string in Caps or Mixed Case: “); //scanf(“%s”,&str); //wont allow spaces gets(str); //gets() allows apaces printf(“\n The entered string in Lower… Continue Reading C PROGRAM EXAMPLE FOR tolower() FUNCTION

C PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING SWITCH LOOP : #include<stdio.h> void main() { float value1,value2; char operator; printf(“\n >>> PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING SWITCH LOOP <<< \n”); printf(“\n Enter Your Expression : “); scanf(“%f %c %f”,&value1,&operator,&value2); switch(operator) { case ‘+’ : printf(“\n Addition Result is : %f… Continue Reading C PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING SWITCH LOOP

Before you go through this post go for the link to know about % operator. -> As % operator cannot used with DOUBLE values, as it generates compile time error, there is a special function ” fmod( ) ” in c. -> fmod( ) return type is double. So, we… Continue Reading How to perform Modulus / Mod operator on double values (OR) FMOD( ) function in C Programming

% OPERATOR IN C : ———————————– -> % OPERATOR is to get the remainder when a number is divided with any other number.        Example: int a=10%2; then the a value is zero. because the when 10 is divided by 2          the remainder is… Continue Reading Modulus / Mod / % operator in C Programming

Syntax of Simple if-else —————————— if(condition) { statement1; statement2; . . . statement n; } else { statement1; statement2; . . . statement n; } Program: #include<stdio.h> void main() {     int num;     printf(” >>> c program to implement simple if-else <<< \n\n”);     printf(“\n Enter… Continue Reading C Program to implement Simple if else

Syntax of Simple-if —————————- if(condition) { statement1; statement2; . . . statement n; } Simple C Program to understand Simple if: #include<stdio.h> void main() {     int age;     printf(” >>> c program to implement simple if<<< \n\n”);     printf(“\n Enter the age of the person: “);… Continue Reading C Program to implement Simple if statement

C PROGRAM TO IMPLEMENT QUEUE OPERATIONS USING ARRAY   original post link: http://cprogramsblog.blogspot.in/2012/11/c-program-to-implement-queue-operations.html #include<stdio.h> #include<conio.h> #define MAX 10 int queue[MAX], front = –1, rear = –1; void Insert_Element(); void Delete_Element(); void Display_Queue(); void Empty_Queue();   int main() { int option; printf(“>>> c program to implement queue operations <<<“); do { printf(“\n\n 1.Insert an element”); printf(“\n 2.Delete an element”); printf(“\n 3.Display queue”); printf(“\n 4.Empty queue”); printf(“\n 5.Exit”); printf(“\n Enter your choice:… Continue Reading C PROGRAM TO IMPLEMENT QUEUE OPERATIONS USING ARRAY

/*program for implementing Stack Operations*/ #include<stdio.h> #include<conio.h> int stack[10],top=-1; //global declaration void push();  //declaring functions void pop(); void display(); void main() { int ch; printf(“>>> StackOperations <<<\n\n“); do { printf(“\n 1.Push”); printf(“\n 2.Pop”); printf(“\n 3.Display”); printf(“\n 4.Exit”); printf(“\n Enter your choice: “); scanf(“%d”,&ch); if(ch==1) push(); else if(ch==2) pop(); else if(ch==3)… Continue Reading C PROGRAM TO IMPLEMENT STACK OPERATIONS

/**  working with user defined header files in C  **/ for creating a user defined header file , we have to write the functions and we have to save that file with ‘ .h ‘ extension. let us see with a small example program , which helps in understanding the… Continue Reading Working with User Defined Header Files in C Program