Problem 16: Admission

Suppose you are going to apply for admission in a college. If you got GPA 5 in SSC exam then you can apply for that college. Now give your GPA as input from the keyboard and print “YES” if you can apply otherwise print “NO”.

Code: 
 

    #include<stdio.h> 


int main()
{

   double gpa;
   printf("Enter your GPA (2.00 - 5.00): \n");
   scanf("%lf",&gpa);

   if(gpa<	5.00)
   {
       printf("NO\n");
   }
   else
   {
       printf("YES\n");
   }

    return 0;
}
Problem 17: GPA

Take a value from user and assume that- it is the number of his math exam.

Now you have to write a program which shows the grade depending on the given scale.

(A+: 80-100, A: 70-79, A-: 60-69, B: 50-59, C: 40-49, D :33-39 ,F :0-32)

Code: 
 

    #include<stdio.h> 


int main()
{

    double mark;
    printf("Enter your marks in math: \n");
    scanf("%lf",&mark);

    if(mark<=100 && mark>=80)
    {
        printf("Your Grade: A+\n");

    }else if(mark<80 && mark >=70)
    {
        printf("Your Grade: A\n");
    }
    else if(mark<70 && mark >=60)
    {
        printf("Your Grade: A-\n");
    }
    else if(mark<60 && mark >=50)
    {
        printf("Your Grade: B\n");
    }
    else if(mark<50 && mark >=40)
    {
        printf("Your Grade: C\n");
    }
    else if(mark<40 && mark >=33)
    {
        printf("Your Grade: D\n");
    }
    else if(mark<33)
    {
        printf("Your Grade: F\n");
    }

    return 0;
}
Problem 18: Bank Account

You are going to open a bank account . If your age is greater than 18 then you can open an account. Get your age by input and print “Yes” if you can open an account otherwise print “No”.

Code: 
 

    #include<stdio.h> 


int main()
{

   int age;
   printf("Enter your age: \n");
   scanf("%d",&age);

   if(age <= 18)
   {
       printf("NO\n");
   }
   else
   {
       printf("YES\n");
   }

    return 0;
}
Problem 19: Odd or Even

Write a program which determines whether a number is ODD or EVEN.

Code: 
 

    #include<stdio.h> 


int main()
{

    int num;
    printf("Enter a number to test: \n");
    scanf("%d",&num);

    if(num%2 == 0)
    {
        printf("Even Number\n");
    }
    else
    {
        printf("Odd Number\n");
    }

    return 0;
}
Problem 20: Divisible

Take an integer number as input from user and print “Yes” if the number is divisible by 3 and 5. And print “No” if the number is not.

Code: 
 

    #include<stdio.h> 


int main()
{

    int num;
    printf("Enter a number to test: \n");
    scanf("%d",&num);

    if(num%3 == 0 && num%5 == 0)
    {
        printf("YES\n");
    }else
    {
        printf("NO\n");
    }

    return 0;
}
Problem 21: Maximum

Take 3 integers from user using scanf() function and write a program to find the maximum one.

Code: 
 

    #include<stdio.h> 


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

    if(a>b && a<c)
    {
        printf("Max: %d\n",a);

    }else if(b > c)
    {
        printf("Max: %d\n",b);
    }else
    {
        printf("Max: %d\n",c);
    }

    return 0;
}
Problem 22: Vowel

Take a small letter alphabet as input and print whether it is VOWEL or CONSONANT.

Code: 
 

    #include<stdio.h> 


int main()
{
    char letter;
    printf("Enter a small letter alphabet:\n");
    scanf("%c",&letter);

    if(letter=='a'||letter=='e'||letter=='i'||letter=='o'||letter=='u'){
       printf("%c is Vowel\n",letter);
    }
    else{
       printf("%c is Consonant\n",letter);
    }

    return 0;
}
Problem 23: Months Name

Write a program that takes an integer as input [ 1 – 12 ] and print the corresponding month name. [If user gives input ‘1’ you should print ‘January’]

Code: 
 

    #include<stdio.h> 


int main()
{

    int month;
    printf("Enter the integer [1 - 12]:\n");
    scanf("%d",&month);

    if(month == 1)
    {
        printf("January\n");
    }else if(month == 2)
    {
        printf("February\n");
    }
    else if(month == 3)
    {
        printf("March\n");
    }
    else if(month == 4)
    {
        printf("April\n");
    }
    else if(month == 5)
    {
        printf("May\n");
    }
    else if(month == 6)
    {
        printf("June\n");
    }
    else if(month == 7)
    {
        printf("July\n");
    }
    else if(month == 8)
    {
        printf("August\n");
    }
    else if(month == 9)
    {
        printf("September\n");
    }
    else if(month == 10)
    {
        printf("October\n");
    }
    else if(month == 11)
    {
        printf("November\n");
    }
    else if(month == 12)
    {
        printf("December\n");
    }else{
        printf("Invalid input.\n");
    }

    return 0;
}
Problem 24: Salary Scale

You are given the rank and salary scale of a company-

Rank – salary

1 – 2,50,000 BDT

2 – 2,10,000 BDT

3 – 1,50,000 BDT

4 – 80,000 BDT

>=5 – 50,000 BDT

Now, take the rank as input from the user and print the salary of the given rank. [If user gives input ‘3’ you should print ‘Your Salary: 1,50,000 BDT’]

Code: 
 

    #include<stdio.h> 


int main()
{
    int rank;
    printf("Please enter your rank:\n");
    scanf("%d",&rank);

    if(rank == 1)
    {
        printf("Your Salary: 2,50,000 BDT.\n");
    }
    else if(rank == 2)
    {
        printf("Your Salary: 2,10,000 BDT.\n");
    }
     else if(rank == 3)
    {
        printf("Your Salary: 1,50,000 BDT.\n");
    }
     else if(rank == 4)
    {
        printf("Your Salary: 80,000 BDT.\n");
    }
     else if(rank >= 5)
    {
        printf("Your Salary: 50,000 BDT.\n");
    }

    return 0;
}
Problem 25: Coordinate

Take two integers indicating the x and y coordinate of a two-dimensional graph paper where the center point is x = 0 and y = 0. Now print the quadrant of the given point. [If user gives input (4,5) you should print ‘First quadrant’; If user gives input (-4,-5) you should print ‘Third quadrant’ ]

Code: 
 

    #include<stdio.h> 


int main()
{

    int x,y;
    printf("Enter the value of X and Y coordinate:\n");
    scanf("%d%d",&x,&y);

    if(x > 0 && y > 0)
    {
        printf("First Quadrant\n");
    }
    else if(x < 0 && y > 0)
    {
        printf("Second Quadrant\n");

    }else if(x <0 && y < 0)
    {
        printf("Third Quadrant\n");

    }else
    {
        printf("Fourth Quadrant\n");
    }

    return 0;
}