Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Exercise problem.Score mark program.

$
0
0
//WAP to print Grade of a Student
#include<stdio.h>

int main(void)
{
	int s,a,b,c,d,e;
	
	a=(s>=90);
	b=(s>=80 && s<=89);
	c=(s>=70 && s<=79);
	d=(s>=60 && s<=69);
	e=(s<60);
	
	do
	{
	printf("\nEnter score:\n");
	scanf("%d",&s);
	
	if (s<0 || s>100)
      printf("impossible score\n");
	else if(s>=90)
	  printf(" \n  grade  A ");
	else if(s>=80 && s<=89)
	  printf(" \n grade B");
	else  if(s>=70 && s<=79)
	  printf(" \n grade C ");
	else if(s>=60 && s<=69)
	  printf(" \n grade D ");
    else if(s<60)
	  printf(" \n grade E ");
	  
    }while (s<0 || s>100);
    
    printf("score results:\n");
    printf("A  : %d" ,a);
    printf("B  : %d" ,B)/>;
    printf("C  : %d" ,c);
    printf("D  : %d" ,d);
    printf("E  : %d" ,e);
    
    return 0;
    
}
	



Sorry,im a newbie and fail in executing the solution for the above exercise.The question require to use do-while and print out the result upon a negative entry or any entry more than 100.Can someone helps by providing some guide?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>