C Program to Find the Size of int, float, double and char

Program to Find the Size of Variables #include<stdio.h> int main() { int intType; float floatType; double doubleType; char charType; // sizeof evaluates the size of a variable printf(“Size of int: %ld bytes\n”, sizeof(intType)); printf(“Size of float: %ld bytes\n”, sizeof(floatType)); printf(“Size of double: %ld bytes\n”, sizeof(doubleType)); printf(“Size of char: %ld byte\n”, sizeof(charType)); return 0; }

C Program to Multiply Two Floating-Point Numbers

Program to Multiply Two Numbers #include <stdio.h> int main() { double a, b, product; printf(“Enter two numbers: “); scanf(“%lf %lf”, &a, &b); // Calculating product product = a * b; // Result up to 2 decimal point is displayed using %.2lf printf(“Product = %.2lf”, product); return 0; }

C Program to Find the Largest Number Among Three Numbers

Using if Statement #include <stdio.h> int main() { double n1, n2, n3; printf(“Enter three different numbers: “); scanf(“%lf %lf %lf”, &n1, &n2, &n3); if (n1 >= n2 && n1 >= n3) printf(“%.2f is the largest number.”, n1); if (n2 >= n1 && n2 >= n3) printf(“%.2f is the largest number.”, n2); if (n3 >= n1 … Read more

C Program to Display Fibonacci Sequence

fibonacci-sequence

The Fibonacci sequence is a sequence where the next term is the sum of the previous two terms. The first two terms of the Fibonacci sequence are 0 followed by 1. The Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21 Visit this page to learn about the Fibonacci sequence. Fibonacci Series up … Read more