snaptrap013 icon

fixed

snaptrap013 | PRO | 05/15/21 04:17:47 PM UTC | 0 ⭐ | 811 👁️ | Never ⏰ | []
C |

2.28 KB

|

None

|

0 👍

/

0 👎

#include <stdio.h>
 
int main ()
{
    char name[50], email[50], symptomA, symptomB;
    char area, country, contact;
    float scores, scoreA, scoreB, scoreC, scoreD, scoreE;
    float status;
    printf ("Enter your name\t:");
    gets(name);
    printf ("Enter your email:");
    gets(email);
 
 
 
    printf ("\n a) Fever");
    printf ("\n b) Chills ");
    printf ("\n c) Shivering");
    printf ("\n d) Body ache");
    printf ("\n e) Headache");
    printf ("\n f) Sore throat ");
    printf ("\n g) Nausea or vomiting ");
    printf ("\n h) Fatigue ");
    printf ("\n i) Runny nose or nasal congestion");
    printf ("\n\nAre you exhibiting 2 or more symptoms as listed above?");
    printf ("\n\tY:Yes | N:No :");
    symptomA = getchar();
    getchar();
 
 
    printf ("\n a) Loss of smell");
    printf ("\n b) Loss of taste ");
    printf ("\n c) Cough ");
    printf ("\n d) Difficulty breathing");
    printf ("\n\nBesides the above, are you exhibiting any of the symptoms listed below?");
    printf ("\n\tY:Yes | N:No :");
    symptomB = getchar();
    getchar();
 
    printf ("\n\nHave you attended any event / areas associated with known COVID-19 cluster?");
    printf ("\n\tY:Yes | N:No :");
    area = getchar();
    getchar();
 
    printf ("\n\nHave you travelled to any country outside Malaysia within 14 days before onset of symptoms?");
    printf ("\n\tY:Yes | N:No :");
    country = getchar();
    getchar();
    
    printf ("\n\nHave you had close contact to confirmed or suspected case of COVID-19 within 14 days before onset of illness?");
    printf ("\n\tY:Yes | N:No :");
    contact = getchar();
 
    if (symptomA=='N'||symptomA=='n')
        scoreA+=1;
    else
        scoreA+=0;
    if (symptomB=='N'||symptomB=='n')
        scoreB+=1;
    else
        scoreB+=0;
    if (area=='N'||area=='n')
        scoreC+=1;
    else
        scoreC+=0;
    if (country=='N'||country=='n')
        scoreD+=1;
    else
        scoreD+=0;
    if (contact=='N'||contact=='n')
        scoreE+=1;
    else
        scoreE+=0;
 
    scores=scoreA+scoreB+scoreC+scoreD+scoreE;
    status=(scores/5)*100;
 
    printf ("\nName\t:%s",name);
    printf ("\nEmail\t:%s",email);
    printf ("\nPercent Health:%.2f",status);
 
 
 
 
 
 
 
 
}

Comments