Close
Close

Write a program for the following question

   preeti.priyadarsini

A student will not be allowed to sit in the exam if his/her attendance is less than 75%. The student will be only allowed to sit if he/she has a medical cause. Ask the user if he/she has a medical cause (Y or N). Take the following input from the user:

  1. No. of classes held
  2. No. of classes attended
  3. Print % of classes attended and if the student is allowed to sit in the exam or not. Print accordingly.

  • #include<iostream> using namespace std; int main() { int attendence,a,b; cout<<"enter how many no of classes held\n"; cin>>a; cout<<"how many classes you attempt\n"; cin>>b; attendence=b*100/a; cout<<"attendence % is\n="<<attendence<<endl; if(attendence>100) { cout<<"enter a valid details"; } else if(attendence>=75 ) { cout<<"yes you are eligible to write a exam"; } else cout<<"your attendence is less than 75% , So you are not eligible to right a exam"; return 0; }
    - gyanprakash.cse

Answers

  •   
    #include <stdio.h>
    int main() {
        printf("The mimimum attendance for giving the examination is 75 percent. \n");
        printf("enter details to check eligibility:\n");
        float a, b;
        printf("enter the total no. of classes held.\n");
        scanf("%f", &a);
        printf("enter the no. of classes attended.\n");
        scanf("%f", &b);
        if((b/a) * 100 < 75) {
            printf("your attendance is less than 75%.\n");
            char c;
            printf("Do you have a medical cause? 'Y' for yes and 'N' for no.\n");
            scanf(" %ch", &c);
        switch(c) {
        case 'Y':
            printf("you are eligible for giving the examinations.");
              break;
          case 'N': 
          printf("sorry, you are not eligible for giving the examinations.");
          break;
          default:
              printf("Invalid input.");
      }
        } else {
            printf("you are eligible for giving the examinations.");
        }
        return 0;
    }
    


  •   

    #include <stdio.h>
    #include <stdlib.h>

    int main()
    {
        char cause;
        int attendance,held;
        int percent;


        printf("Do you have any medical cause(Y/N): ");
        scanf("%c", &cause);

        if (cause == 'Y')
        {
            printf("Enter number of classes held\n");
            scanf("%d", &held);
            printf("Enter number of classes attended\n");
            scanf("%d", &attendance);
            percent = (attendance / held) * 100;

            if ( percent <= 75)
            {
                printf("Your percentage attendance is %d\n",percent);
                printf("Your are not allowed to sit for the exam");
            }

            else
            {
                printf("Your percentage attendance is %d\n",percent);
                printf("You are allowed to sit for the exam\n");
            }
        }

        else if ( cause == 'N')
            printf("You are not allowed to sit for the exams\n");
        else
            printf("Invalid input");
        return 0;
    }



  •    BenTr

    It is very difficult for me to write something, be it programs, be it texts. Therefore, while writing a personal statement for medical fellowship, I immediately took the help of specialists and was sure that my application would not only be correctly written, but also considered in the forefront.



  •    seoexpertim

    I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. Privacy Guides



  •    jamiebarnes

    Becoming a certified Salesforce OmniStudio Developer can significantly enhance your career prospects in the Salesforce ecosystem. By studying the official materials, practicing with mock exams, and using resources like the OmniStudio-Developer exam questions provided, you'll be well-prepared to ace the OmniStudio-Developer Exam and demonstrate your expertise in building custom applications and automating business processes using Salesforce OmniStudio.



  •    RyanAndres

    Our The Open Group OGBA-101 practice test is the most reliable solution to quickly prepare for your The Open Group Designing The Open Group Azure Infrastructure Solutions. We are certain that our The Open Group OGBA-101 practice exam will guide you to get certified on the first try. Here is how we serve you to prepare successfully

     



  •    maxkvinton

    I recently came across an article about the 10 best essay writing services, and it was a game-changer for me. This article provides a comprehensive review of the top services in the field. It helped me choose a reliable writing service for my academic needs. I highly recommend pop over to this site it to all students out there.



Ask Yours
Post Yours
Write your answer