## How to reverse a given number using C

Updated on 16-Dec-2021 15:57:52
#include <stdio.h> int main() { int num, rem, rev = 0; printf("\nEnter any no to be reversed : "); scanf("%d", &num); while (num >= 1) { rem = num % 10; rev = rev * 10 + rem; num = num / 10; } printf("\nReversed Number : %d", rev); return (0); } Output : Enter any no to be reversed : 123 Reversed Number : 321 ... Read Mores

## How to calculate gross salary of a person using C Program

Updated on 16-Dec-2021 15:48:12
#include <stdio.h> int main() { int gross_salary, basic, da, ta; printf("Enter basic salary : "); scanf("%d", &basic); da = (10 * basic) / 100; ta = (12 * basic) / 100; gross_salary = basic + da + ta; printf("\nGross salary : %d", gross_salary); return (0); } Output : Enter basic Salary : 1000 Gross Salart : 1220 ... Read Mores

## How to reads customer number and power consumed and prints amount to be paid using C

Updated on 16-Dec-2021 15:43:12
An electric power distribution company charges its domestic consumers as follows Consumption Rate of Units Charge ------------------------------------ 0-200 Rs.0.50 per unit 201-400 Rs.100 plus Rs.0.65 per unit excess 200 401-600 Rs.230 plus Rs.0.80 per unit excess of 400. ------------------------------------ Write a C program that reads the customer number and power consumed and prints the amount to be paid by the customer. P... Read Mores

## How to read the values of x, y and z and print the results expressions in one line using C Program

Updated on 16-Dec-2021 15:31:37
Problem Statement : Write a program to read the values of x, y and z and print the results of the following expressions in one line. (x+y+z) / (x-y-z) (x+y+z) / 3 (x+y) * (x-y) * (y-z) Program : #include<stdio.h> #include<conio.h> void main() { int x, y, z; float a, b, c; clrscr(); printf("\nEnter the values of x,y and z : "); scanf("%d %d %d", &x, &y, &z); a = (x + y + z) / (x - y - z); b = (x + y + z) / 3; c = (x + y) * (x - y) ... Read Mores

## Write C program to find Exponent Power Series

Updated on 12-Dec-2021 20:35:06
Program : A program to evaluate the power series x2 x3 xn ex = 1 + x + --- + --- + ..... + ---- 2! 3! n! , 0 < x < 1 It uses if……else to test the accuracy. The power series contains the recurrence relationship of the type Tn = Tn-1 (---) for n > 1 T1 = x for n = 1 T0 = 1 If Tn-1 (usually known as previous term) is known, then Tn (known as present term) can be easily found by multiplying the previous ter... Read Mores

## Write a ‘C’ Program to compute the sum of all elements stored in an array using pointers

Updated on 13-Apr-2024 10:01:13
In C programming, arrays and pointers are powerful features that allow efficient manipulation of data. Utilizing pointers to access and traverse array elements can lead to more concise and sometimes more efficient code. In this article, we'll discuss how to compute the sum of all elements stored in an array using pointers in C, along with a practical example. Example: #include <stdio.h> int arraySum(int *ptr, int size) { int sum = 0; int *end = ptr + size; // Pointer to the end o... Read Mores

## How to check the type of triangle using C

Updated on 12-Dec-2021 17:04:29
C Program to check the type of triangle #include <stdio.h> #include <math.h> int main() { int side1, side2, side3; //Change values accordingly side1 = 5; side2 = 4; side3 = 3; if ((side1 + side2 > side3 && side1 + side3 > side2 && side2 + side3 > side1) && (side1 > 0 && side2 > 0 && side3 > 0)) { if (side1 == side2 && side2 == side3) { printf("Equilateral... Read Mores

## How to Calculate Area of Circle using C Programming

Updated on 12-Dec-2021 13:17:37
C Program to Calculate Area of Circle Shape : Circle Formula : Π * r * r Definition : 1. Ellipse in which the two axes are of equal length 2. Plane curve generated by one point moving at a constant distance from a fixed point 3. You can compute the area of a Circle if you know its radius. Program : #include <stdio.h> int main() { float radius, area; printf("\nEnter the radius of Circle : "); scanf("%d", &radius); area = 3.14 * radius * radius;... Read Mores

## How to Calculate Area of Rectangle using C Program

Updated on 12-Dec-2021 13:06:07
C Program to Calculate Area of Rectangle Shape : Rectangle formula : area = l * b Definition : 1. A plane figure with 4 sides and 4 right angles and having Equal Opposite Sides 2. Adjucent sides makes an angle of 90 degree 3. You can compute the area of a Rectangle if you know its length and breadth Program :  #include <stdio.h> #include <conio.h> int main() { int length, breadth, area; printf("\nEnter the Length of Rectangle : "); scanf("%d", &... Read Mores

## How to Calculate Area of Right angle Triangle using C Language

Updated on 09-Apr-2023 10:53:03
C Program to Calculate Area of Right angle Triangle Definition : Triangle having one angle of measure 90 degree is called Right angle Triangle. Sides of Triangle are : base , height , hypotenuse. You can compute the area of a Traingle. if you know its any two sides. Program :  #include <stdio.h> int main() { int base, height; float area; printf("\nEnter the base of Right Angle Triangle : "); scanf("%d", &base); printf("\nEnte... Read Mores