TO ACCEPT BASIC SALARY FROM THE USER. IF BASIC SALARY>=5000 THEN HRA=15% % DA=150% OF BASIC SALARY.IF BASIC SALARY < 5000 THEN HRA=10% & DA=110% OF BASIC SALARY. DISPLAY GROSS SALARY

3 comments

#include<stdio.h>
void main()
{
    float basic, hra, da;
    printf("Enter basic salary");
    scanf("%f",&basic);
    if(basic < 5000)
    {
        hra = 5000 * (15/100);
        da = 5000 * (150/100);
    }
    else if(basic >= 5000)
    {
        hra = 5000 * (10/100);
        da = 5000 * (110/100);
    }
    printf("Gross salary = %f",(basic + hra + da));
}   

TO CHECK WHETHER INPUTTED CHARACTER IS DIGIT OR ALPHABET

0 comments

#include<stdio.h>
void main()
{
    char ch;
    printf("Enter a charecter");
    scanf("%c",&ch);
    if((ch >= 65 && ch <= 90) || (ch >= 97 && ch <=    122))
        printf("Entered charector is alphabet");
    else if(ch >= 48 && ch <= 57)
        printf("Entered charector is digit");
}

TO CHECK WHETHER A GIVEN NUMBER IS POSITIVE OR NEGATIVE, IF NUMBER IS POSITIVE CHECK WHETHER IT IS ODD OR EVEN

0 comments

#include<stdio.h>
void main()
{
    int num;
    printf("Enter a number");
    scanf("%d",&num);
    if(num > 0)
    {
        printf("Number is +ve\n");
        if(num % 2 == 0)
            printf("Number is Even");
        else
            printf("Number is Odd");
    }
    else
        printf("Number is -ve");
}