if or else question.

0 votes
asked Nov 14, 2017 by anonymous
Write a program that reads your lab mark from the keyboard (with an assumption that you’ll enter only valid value, which is in between 0 to 100) and converts the mark to be over 15 percent. For example, if your lab mark is 90 then the converted lab score is 13.5. Next, print “My lab score is” followed by the lab score. If the lab mark percentage is more than 13, display “Well done!” message on the screen. Otherwise, print “Don’t be sad, do your best in your final exam.” message. This is followed by “[endof-program]” message. Two samples input and output of the program are shown below and should guide you in writing the program:

2 Answers

0 votes
answered Nov 28, 2017 by Sathyamshu (260 points)

#include<stdio.h>

void main()

{

float lmark,fmark; // lmark to store the lab marks and fmark to store lab score

printf("Enter the lab marks u got - ");

scanf("%f" ,&lmark);

fmark=(15.0/100)*lmark;

printf("Your lab score is %0.2f" ,fmark);

if(fmark>13)

printf(  “\n\nWell done....!”);

else

printf(“\n\nDon’t be sad, do your best in your final exam.”);

}

0 votes
answered Nov 28, 2017 by anonymous

# include < stdio.h>

int main ()

{ float m ,lapmark;

scanf("%f",&lapmark);

m = 0.15*lapmark;

if(m>13){

printf("well done ");

}

else if(m<13){  printf("try hard next");

}

return 0;

}

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...