Category Archives: Basic C Programs C Source Code

Find Largest of three double numbers if and Logical Operators

Find Largest of three double numbers #include <stdio.h> int main() { int n1, n2, n3, max; printf(“Enter first number=”); scanf(“%d”,&n1); printf(“Enter second number=”); scanf(“%d”,&n2); printf(“Enter third number=”); scanf(“%d”,&n3); max = (n1 > n2) ? (n1 > n3 ? n1 : n3) : (n2 > n3 ? n2 : n3); printf(“Largest number among %d, %d and… Read More »

Loading

C Program Find Largest of Three Using Ternary Operator

Find Largest of Three Using Ternary Operator: C Program Find Largest of Three #include <stdio.h> int main() { int n1, n2, n3, max; printf(“Enter first number=”); scanf(“%d”,&n1); printf(“Enter second number=”); scanf(“%d”,&n2); printf(“Enter third number=”); scanf(“%d”,&n3); max = (n1 > n2) ? (n1 > n3 ? n1 : n3) : (n2 > n3 ? n2 :… Read More »

Loading

Find Largest of Two Numbers Ternary Operator

Find Largest of Two Numbers Ternary Operator #include<stdio.h> int main() { int num1, num2; printf(“Enter First Number=”); scanf(“%d”, &num1); printf(“Enter 2nd Number=”); scanf(“%d”, &num2); if(num1 == num2) printf(“First Number %d is equal to Second Number %d “, num1,num2); else printf(“First Number %d is not equal to Second Number %d “, num1,num2); return 0; } Output:… Read More »

Loading

Check Both Numbers are Equal if else

Check Both Numbers are Equal if else #include<stdio.h> int main() { int num1, num2; printf(“Enter First Number=”); scanf(“%d”, &num1); printf(“Enter 2nd Number=”); scanf(“%d”, &num2); if(num1 == num2) printf(“First Number %d is equal to Second Number %d “, num1,num2); else printf(“First Number %d is not equal to Second Number %d “, num1,num2); return 0; }

Loading