C language

Program to display sum of series 1+1/2+1/3+…+1/n in C language

The following C program is to find the sum of the series 1+1/2+1/3+…+1/n. The following code have been compiled and executed in Dev C++. Information about the code:  > The variables have been taken in float, but you can also […]

Program to Reverse a number in C language

The following program will show how you can reverse a particular number in C language. The code has been written and compiled in Dev C++. code: #include void main(){ int n,a,r=0; printf(“Enter any number: “); scanf(“%d”,&n); while(n>=1) { a=n%10; r=r*10+a; […]

Program to Calculate Simple Interest in C language

This is the C program to calculate Simple Interest. We calculate simple interest to calculate interest charge on the loan. The following C program has been written and compiled on Dev C++. Code: #include<stdio.h> void main(){ int t; float p,r,si; […]

C Program to Compare two Strings

This C program compares two string and tell if they are equal or not. We are taking two strings here str and str1. It is an array with 30 indexes. There are two int variables i and j which will […]

Program to reverse a string in C Language

The program below shows how you can reverse a string in c program. In this program I have used two arrays,one array is for the actual string to reverse and another array will keep the reversed string. The while function […]

C Program to Swap two numbers with and without third variable

There are two ways to swap numbers using C language, one is with the help of temporary third variable and other is without the third variable. In this article, we will be looking at both of those approaches. Program to […]

Program to Convert Celsius to Fahrenheit in C Language

This article will show you the C program to convert temperature in Celsius to Fahrenheit. The Formula for conversion is: 1.8 * C + 32 Code: #include<stdio.h> void main(){ int a; float i=1; printf(“\n********************************\nprogram to convert Celsius to Fahrenheit\n***********************************\n\n”); printf(“Enter […]

Program to convert a Character into ASCII value using C Language

In C language, The integer value for a character is always it’s ASCII value. So If you want to print an ASCII value of a character in C then simply use %d to get the character’s ASCII integer value. Code: […]

Patterns Program Using C Language

The below article consists of different patterns that can be generated using C programs. Code-1: #include<stdio.h> void main(){ int i,j,k; int c=1,v=0; for(i=1;i<=9;i++){ if(i%2!=0){ for(j=i;j<=9;j++) { printf(” “); } for(k=1;k<=i;k++){ c++; if(c%2!=0){printf(“1 “); } else if(v==0) { printf(“1 “); v++;} […]

Program to Read an Input Keystroke using C Language

**Note: To perform this I have used Dev c++ tool. It is checked and compiled. We can simple use getchar() to read the input character in C language Code: #include<stdio.h> void main(){ char c; printf(“\n\n*****************Program to Read an Input Keystroke******************\n\n”); […]

%d bloggers like this: