Skip to main content

Create an equivalent code segment using else ... if ladder:

Create an equivalent code segment using else ... if  ladder:

Subject’s
Mark Grade
marks>79
A
marks>69
B
marks>59
C
marks>49
D
marks>39
E
marks<=39
F

Answer:
#include<stdio.h>
#include<conio.h>
void main(){
       clrscr();


       int mark;
       printf("Enter the mark: ");
       scanf("%d",&mark);

       if((mark>79)&&(mark<=100)){
            printf("Grade: A");
       }

       else if((mark>69)&&(mark<=79)){
            printf("Grade: B");
       }

       else if((mark>59)&&(mark<=69)){
            printf("Grade: C");
       }

       else if((mark>49)&&(mark<=59)){
            printf("Grade: D");
       }

       else if((mark>39)&&(mark<=49)){
            printf("Grade: E");
       }

       else{
            printf("Grade: F");
       }

getch();
}

Simple Output:
            Enter the mark: 84

            Grade: A

Popular posts from this blog

Draw the basic organization of computer

Answer:                 The basic organization of computer__ Input Unit: ·          It accepts (or reads) instructions and data from outside. ·          It converts these instructions and data in computer acceptable form ·          It supplies the converted instructions and data to the computer system for further processing. Central Processing Unit (CPU): Control Unit: Control unit of a computer system manages and coordinates the operations of all other components of the computer system. Arithmetic Logic Unit(ALU): Arithmetic logic unit of a computer system is the place, where the actual executions of instruction, takes place during processing operation. Storage Unit: Primary Memory: It is volatile ( loses data on power ...

Differences between positional and non-positional number system?

Answer: Positional Number System: In positional number system, there are only a few symbols called digits, and these symbols represent different values depending on the position they occupy in the number. The value of each digit in such a number is determined by three considerations__ 1.       The digit. 2.       The position of the digit in the number. 3.       The base of the number system.