Algorithm: Start the programGet two numbers from userStored the numbers in num1 & num1If num1 is greater than num2 then num1 is maximum.Else num2 is greaterDisplay the maximum number in outputStop the program Program: #include <stdio.h>int main(){ int num1, num2; printf("Enter two numbers: "); scanf("%d%d", &num1, &num2); if(num1 > num2) { printf("%d is maximum", num1); … Continue reading Display Maximum number in c
c programming
C program for tower for hanoi
Algorithm: Start the programOnly one disk can be moved at a time.Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack.No disk may be placed on top of … Continue reading C program for tower for hanoi
Factorial of a Number Using Recursion
Algorithm: Start programAsk the user to enter an integer to find the factorialRead the integer and assign it to a variableFrom the value of the integer up to 1, multiply each digit and update the final valueThe final value at the end of all the multiplication till 1 is the factorialStop the program Program: #include<stdio.h>long … Continue reading Factorial of a Number Using Recursion
Arithmetic operations in C programming
ALGORITHM: 1. Start 2. Declare variables 3. Read the Inputs . 4. Calculate Arithmetic operations(+,-,*,/,pow) for the input of two numbers. 5. Display the output of the calculations . 6. Stop PROGRAM: #include <stdio.h> #include <conio.h> int main(){ int firstNumber, secondNumber; int sum, difference, product; long square; float quotient; … Continue reading Arithmetic operations in C programming
C PROGRAM TO SORT THE NUMBERS BASED ON THE WEIGHT
ALGORITHM: 1. Start 2. Declare variables 3. Read the number of elements . 4. Get the individual elements. 5. Calculate the weight for each element by the conditions 5 if it is a perfect cube (pow) 4 if it is a multiple of 4 and divisible by 6 … Continue reading C PROGRAM TO SORT THE NUMBERS BASED ON THE WEIGHT
C PROGRAM TO FIND AVERAGE HEIGHT OF A PERSON
ALGORITHM: 1. Start 2. Declare variables 3. Read the total number of persons and their height. 4. Calculate avg=sum/n and find number of persons their h>avg. 5. Display the output of the calculations . 6. Stop PROGRAM: #include <stdio.h> #include <conio.h> void main() { int i,n,sum=0,count=0,height[100]; float avg; //Read … Continue reading C PROGRAM TO FIND AVERAGE HEIGHT OF A PERSON
C PROGRAM TO FIND THE BODY MASS OF THE INDIVIDUALS
ALGORITHM: 1. Start 2. Declare variables 3. Read the number of persons and their height and weight. 4. Calculate BMI=W/H 2 for each person 5. Display the output of the BMI for each person. 6. Stop PROGRAM: #include<stdio.h> #include<math.h> int main(void){ int n,i,j; printf("How many people's BMI do you … Continue reading C PROGRAM TO FIND THE BODY MASS OF THE INDIVIDUALS
C PROGRAM TO PERFORM REVERSE OF A GIVEN STRING
ALGORITHM: 1. Start 2. Declare variables . 3. Read a String. 4. Check each character of string for alphabets or a special character by using isAlpha() . 5. Change the position of a character vice versa if it is alphabet otherwise remains same. 6. Repeat step 4 until reach … Continue reading C PROGRAM TO PERFORM REVERSE OF A GIVEN STRING
C Program To Conversion of Decimal number into other bases
ALGORITHM: 1. Start 2. Declare variables. 3. Read a decimal number. 4. Develop the procedure for conversion of different base by modulus and divide operator. 5. Display the output of the conversion value. 6. Stop PROGRAM: #include<stdio.h> #include<stdlib.h> int main(){ int a[10],n,i; system ("cls"); printf("Enter the number to convert: … Continue reading C Program To Conversion of Decimal number into other bases
C Program To Check Amstrong Number
ALGORITHM: 1. Start 2. Declare variables 3. Read the Input number. 4. Calculate sum of cubic of individual digits of the input. 5. Match the result with input number. 6. If match, Display the given number is Armstrong otherwise not. 7. Stop. Program: #include <stdio.h> #include <math.h> void … Continue reading C Program To Check Amstrong Number