Home / Tag Archives: C programs

Tag Archives: C programs

Program to find Factorial of a Number

Following is the program to find factorial of a number using for loop. #include<stdio.h> #include<conio.h> void main() { int fact,i,n; fact = 1; printf("Enter the number\t"); scanf("%d" , &n); for(i …

Read More »

Program to Reverse a String

Following is the program to Reverse a String using for loop. #include<stdio.h> #include<conio.h> void main() { int i, j, k; char str[100]; char rev[100]; printf("Enter a string\t"); scanf("%s", str); printf("The …

Read More »

Program to find sum of digits of a Number

Following is the program to find out sum of digits of a number using loops. #include<stdio.h> #include<conio.h> int sumOfDigit(int num); void main() { int num, sum; clrscr(); printf("Enter a number\t"); …

Read More »

Program to Sort an Array element

#include<stdio.h> #include<conio.h> void sorting(int *x,int y); void main() { int a[5],b,c; clrscr(); printf("Enter 5 numbers"); for(b = 0; b < 5; b++) { scanf("%d",&a[b]); } sorting(a,5); getch(); } void sorting(int …

Read More »

Program to Swap Variable’s Numeric Values

In this program we will swap values of two variables. The values are numeric and we will swap them using different techniques(some tricky ones too). Let’s start with the simplest …

Read More »

Program to Check whether a Number is Pallindrome

#include<stdio.h> #include<conio.h> void main() { int a, b, c, s=0; clrscr(); printf("Enter a number:\t"); scanf("%d", &a); c = a; //the number is reversed inside the while loop. while(a > 0) …

Read More »

Program to Remove duplicate Element in an Array

Below is a simple and easy to understand program to find and remove any duplicate element present in specified array. #include<stdio.h> #include<conio.h> void main() { int a[20], i, j, k, …

Read More »