Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Print mark-sheet of students

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
/**
*	rl -> Roll No
*	s1 -> Subject1 Marks
*	s2 -> Subject2 Marks
*	s3 -> Subject3 Marks
*	t -> total
*	per -> percentage
*	nm -> name of student
*	div -> division
*/

void main() {
	/*variable declaration part */
	int rl,s1,s2,s3,t;
	float per;
	char nm[25],div[10];
	clrscr();
	/*reading part */
	printf("Enter the Roll No : ");
	scanf("%d",&rl);
	printf("Enter Name        : ");
	fflush(stdin);
	gets(nm);
	printf("Enter Three Subject Marks :
");
	scanf("%d%d%d",&s1,&s2,&s3);
	/* processing part */
	t=s1+s2+s3;
	per=t/3.0;
	if(per>=75)
	     strcpy(div,"Honour"); else if( per>=60)
		  strcpy(div,"First"); else if( per>=48)
			 strcpy(div,"Second"); else if (per>=36)
			     strcpy(div,"Pass"); else
			     strcpy(div,"Fail");
	/* display part */
	printf("		University of Rajasthan
");
	printf("

");
	printf("Roll No: %d 	  Name : %s
",rl,nm);
	printf("---------------------------------------------------
");
	printf("Subject             Max      Min            Obt.Marks
");
	printf("---------------------------------------------------
");
	printf("Hist                100      36              %d
",s1);
	printf("socio.              100      36              %d
",s2);
	printf("Hindi               100      36              %d
",s3);
	printf("---------------------------------------------------
");
	printf("				  Total          %d
",t);
	printf("per  %f			  div: %s 
",per,div);
	printf("---------------------------------------------------
");
	getch();
}
Source by scanftree.com #
 
PREVIOUS NEXT
Tagged: #Print #students
ADD COMMENT
Topic
Name
6+6 =