//Exercise 1: Write a C Program to create the data for some students
//(roll, name, mark1, mark2, mark3, term mark) and then find the total
//marks for each student and average mark of each student.
#include<stdio.h>
void header()
{
printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t Lahore , Pakistan\n\n\n");
}
struct student
{
int rollno;
char name[500];
float mark1;
float mark2;
float mark3;
float term_mark;
float total;
float average;
}st;
int main()
{
header();
system("pause");
system("cls");
printf("Enter Roll No. : ");
scanf("%d",&st.rollno);
fflush(stdin);
printf("\nEnter Name : ");
gets(st.name);
printf("\nEnter Marks 1 : ");
scanf("%f",&st.mark1);
printf("\nEnter Marks 2 : ");
scanf("%f",&st.mark2);
printf("\nEnter Marks 3 : ");
scanf("%f",&st.mark3);
printf("\nEnter Term Marks : ");
scanf("%f",&st.term_mark);
system("cls");
fflush(stdin);
printf("Name : %s ",st.name);
printf("\nMarks 1 : %.2f",st.mark1);
printf("\nMarks 2 : %.2f",st.mark2);
printf("\nMarks 3 : %.2f",st.mark3);
printf("\nTerm Marks : %.2f",st.term_mark);
st.total=0;
st.total=st.mark1+st.mark2+st.mark3+st.term_mark;
st.average=0;
st.average=st.total/4;
printf("\nAverage : %.2f",st.average);
printf("\nTotal : %.2f ",st.total);
printf("\n\n\n");
return 0;
}
//(roll, name, mark1, mark2, mark3, term mark) and then find the total
//marks for each student and average mark of each student.
#include<stdio.h>
void header()
{
printf("\n\n\n\n\n\n\n\t\tBUILT AND DESIGNED BY >> ARSLAN UD DIN SHAFIQ\n\n\t\tWebsite>>\twww.CWorldbyAS.blogspot.com\n");
printf("\n\t\tCOMSATS Institute of Information Technology,\n\n\t\t\t\t\t Lahore , Pakistan\n\n\n");
}
struct student
{
int rollno;
char name[500];
float mark1;
float mark2;
float mark3;
float term_mark;
float total;
float average;
}st;
int main()
{
header();
system("pause");
system("cls");
printf("Enter Roll No. : ");
scanf("%d",&st.rollno);
fflush(stdin);
printf("\nEnter Name : ");
gets(st.name);
printf("\nEnter Marks 1 : ");
scanf("%f",&st.mark1);
printf("\nEnter Marks 2 : ");
scanf("%f",&st.mark2);
printf("\nEnter Marks 3 : ");
scanf("%f",&st.mark3);
printf("\nEnter Term Marks : ");
scanf("%f",&st.term_mark);
system("cls");
fflush(stdin);
printf("Name : %s ",st.name);
printf("\nMarks 1 : %.2f",st.mark1);
printf("\nMarks 2 : %.2f",st.mark2);
printf("\nMarks 3 : %.2f",st.mark3);
printf("\nTerm Marks : %.2f",st.term_mark);
st.total=0;
st.total=st.mark1+st.mark2+st.mark3+st.term_mark;
st.average=0;
st.average=st.total/4;
printf("\nAverage : %.2f",st.average);
printf("\nTotal : %.2f ",st.total);
printf("\n\n\n");
return 0;
}
No comments:
Post a Comment