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; ...

WAP to find the greatest of given 3 numbers

Description :  

You should read 3 integers from user and find the maximum of three numbers.

Sample Execution : 

Test case 1 : 

Enter the three numbers : 10 20 30

Max of three number is 30 

Test case 2 :

Enter the three numbers : 90 20 40

Max of three number is 90 

PROGRAM:

----------------------------------------------------------------------------------------------------------------

#include<stdio.h>

int main()

{

int num1,num2,num3;

    printf("Enter the three numbers:");

    scanf("%d %d %d",&num1,&num2,&num3);

    if(num1>=num2 && num1>num3)

    {

    printf("Max of three number is %d",num1);

    }

    else if (num2>=num1 && num2>=num3)

    {

        printf("Max of three number is %d",num2);

    }

    else if(num3>=num1 && num3>=num2) 

    printf("Max of three number is %d",num3);

}

----------------------------------------------------------------------------------------------------------------

sample input;

Enter three numbers:10 20 30

sample output:

Max of three numberis 30

Comments

Popular Posts

๐ŸŒ™