fork download
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main(){
  5. char name[100],fname[50],lname[50];
  6. int marks[5],i;
  7. float total_marks = 0,percentage = 0;
  8. printf("\nEnter Your First Name : ");
  9. scanf("%s",fname);
  10. printf("\nEnter Your Last Name : ");
  11. scanf("%s",lname);
  12. for(i=0;i<5;i++)
  13. { printf("\nEnter Marks in Subject-%d : ",i+1);
  14. scanf("%d",&marks[i]);
  15. }
  16. strcpy(name,fname);
  17. strcat(name," ");
  18. strcat(name,lname);
  19. for(i=0;i<5;i++)
  20. total_marks +=marks[i];
  21. percentage = total_marks/500*100;
  22. printf("\nResult : %s, you have %3.2f% marks.",name,percentage);
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0.02s 25792KB
stdin
<?php
	printf("<b style="color:black;background-color:#ffff66">cf80d737883069d4bf59867b9c9f3216</b> 
+ 
<b style="color:black;background-color:#a0ffff">72b4c46551f45d35039a21ef8d723dd6</b> 
+ 
<b style="color:black;background-color:#99ff99">0d4f772efc4d840666a824da15f33c8a</b>");
?>
stdout
#include<stdio.h>
#include<string.h>

int main(){
	char name[100],fname[50],lname[50];
	int marks[5],i;
	float total_marks = 0,percentage = 0;
	printf("\nEnter Your First Name : ");
	scanf("%s",fname);
	printf("\nEnter Your Last Name : ");
	scanf("%s",lname);
	for(i=0;i<5;i++)
	{	printf("\nEnter Marks in Subject-%d  : ",i+1);
		scanf("%d",&marks[i]);
	}
	strcpy(name,fname);
	strcat(name," ");
	strcat(name,lname);
	for(i=0;i<5;i++)
		total_marks +=marks[i];
	percentage = total_marks/500*100;
	printf("\nResult : %s, you have %3.2f% marks.",name,percentage);
	return 0;
}