Click here to Skip to main content
15,924,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
#include<stdio.h>
int main(){
	int a,b,c,d,sum;
	printf("Enter the 4 subject marks:");
	scanf("%d%d%d%d%d",&a,&b,&c,&d);
	sum=a+b+c+d;
	printf("Total Marks is:%d",sum);
	if(sum>=50){
		printf("passing");
	}
	else{
		printf("failing");	
	}
	return 0;
}


What I have tried:

#include<stdio.h>
int main(){
	int a,b,c,d,sum;
	printf("Enter the 4 subject marks:");
	scanf("%d%d%d%d%d",&a,&b,&c,&d);
	sum=a+b+c+d;
	printf("Total Marks is:%d",sum);
	if(sum>=50){
		printf("passing");
	}
	else{
		printf("failing");	
	}
	return 0;
}
Posted
Updated 3-Jul-22 1:15am
Comments
Patrice T 3-Jul-22 5:55am    
And you have a problem with this code ?

1 solution

C++
printf("Enter the 4 subject marks:");
scanf("%d%d%d%d%d",&a,&b,&c,&d);

If you used spaces between each pair of %d format controls, you would see that you have one too many.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900