Skip to main content

Featured

C Pattern Programs: Square Number and Alphabet Patterns Explained

πŸ”· Square Star Pattern πŸ“‹ Copy Code #include <stdio.h> int main() { int num; printf("Enter the number:\n"); scanf("%d", &num); for(int i = 1; i <= num; i++) { for(int j = 1; j <= num; j++) { printf("* ");//keep"* " } printf("\n"); } return 0; } πŸ”· Reverse Square Alphabet Pattern (Column-wise) πŸ“‹ Copy Code #include <stdio.h> int main() { int num; printf("Enter the number:\n"); scanf("%d", &num); for(int i = num; i >= 1; i--) { for(int j = num; j >= 1; j--) { printf("%c ", j + 64);//%c for Character and 64 will be ASIIC VALUE } printf("\n"); } return 0; } πŸ”· Reverse Square Alphabet Pattern (Row-wise) πŸ“‹ Copy Code #include <stdio.h> int main() { int num; ...

Find Smallest of Three Numbers in C

Find Smallest of Three Numbers in C

✅ Find the Smallest of Three Numbers in C

#include<stdio.h>

int main() {
    int a, b, c;
    printf("Enter any three numbers:\n");
    scanf("%d %d %d", &a, &b, &c);

    if (a <= b && a <= c) {
        printf("Smallest number among three is: %d\n", a);
    }
    else if (b <= a && b <= c) {
        printf("Smallest number among three is: %d\n", b);
    }
    else {
        printf("Smallest number among three is: %d\n", c);
    }

    return 0;
}
  

πŸ“˜ Explanation:

This C program helps you find the smallest number out of three inputs using conditional logic. It compares:

  • First if a is smaller than or equal to both b and c.
  • If not, it checks if b is the smallest.
  • If both conditions fail, c is the smallest.
This method is efficient and handles equal numbers as well.

🧾 Sample Output:

Enter any three numbers:
12 9 27
Smallest number among three is: 9
  

πŸ”‘ Keywords:

Smallest of three numbers, if else in C, compare numbers in C, minimum value logic, basic C programs, beginner C examples

πŸ“Œ Hashtags:

#CProgramming #SmallestNumber #IfElseC #MinOfThree #BeginnerC #LogicInC

Comments

Popular Posts

πŸŒ™