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

C Program to Find Factorial of a Number

Program to find Factorial of a Number using Recursion

The factorial of a positive number n is given by: factorial of n (n!) = 1 * 2 * 3 * 4….n The factorial of a negative number doesn’t exist. And, the factorial of 0 is 1. Factorial of a Number   #include <stdio.h>   int main() {   int n, i;   unsigned long … Read more

C program to convert time in Hours:Minutes:Seconds to seconds

c program to add 2 numbers

C program to convert time in Hours:Minutes:Seconds to seconds /* C program to convert time in hours:minutes:seconds to seconds */ #include <stdio.h> int main() { int hour, minute, second, timeinsec; printf(“Enter the value for hour:”); /* get hour value from user*/ scanf(“%d”, &hour); printf(“Enter the value for minute:”); /* get minute value from user */ … Read more