Question:WAP in c using all 32 keyword available in ANSCII
solution
#include stdio.h>
#include stdlib.h>
const signed sub = 5;
typedef enum number {student1, student2, student3};
union Job {
unsigned int Tyear;
volatile int Lyear;
} T;
extern float grade=3.0;
struct
{
char fn[12],ln[8];
short int sn,cpl,egp,mat,tsm,phy,t;
float per;
}student[3];
static long int i=0;
int main()
{
auto int choice;
for(i=0;i<3;i++)
{
printf("Enter student %d first name:",i+1);
scanf("%s",student[i].fn);
printf("Enter student %d second name:",i+1);
scanf("%s",student[i].ln);
printf("Enter student number:");
scanf("%d",&student[i].sn);
printf("Enter CPL101 marks:");
scanf("%d",&student[i].cpl);
printf("Enter EGP101 marks:");
scanf("%d",&student[i].egp);
printf("Enter MAT102 marks:");
scanf("%d",&student[i].mat);
printf("Enter TSM101 marks:");
scanf("%d",&student[i].tsm);
printf("Enter PHY101 marks:");
scanf("%d",&student[i].phy);
student[i].t = student[i].phy+student[i].tsm+student[i].mat+student[i].egp+student[i].cpl;
student[i].per=student[i].t/sub;
}
retry:
printf("Press\n 1: to see Highest Percentage\n 2:to see overall grading\n 3:to print result\n" );
scanf("%d",&choice);
switch(choice)
{
case 1: printf("the Highest percentage is:");
topper();
break;
case 2:printf("Analysis:");
news();
break;
case 3:printf("Printing result:");
printingresult();
break;
default: printf("Wrong Choice\n");
goto retry;
}
return 0;
}
void printingresult()
{
printf("\nstd.no name cpl phy mat egp tsm total per\n");
i=0;
do
{
printf("%d\t%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t\t%f\n",student[i].sn,student[i].fn,student[i].ln,student[i].cpl,student[i].phy,student[i].mat,student[i].egp,student[i].tsm,student[i].t,student[i].per);
i++;
}while(i<3);
}
void topper()
{
register double max;
for(i =student1;i<=student3;i++)
{
if(max>student[i].per)
{
continue;
}
else
{
max = student[i].per;
}
}
printf("%4f",max);
}
void news()
{
T.Lyear=2020;
printf("Result in year: %d",T.Lyear);
printf("\nGrade last year: %f",grade);
T.Tyear=2021;
printf("\nResult this year %d",T.Tyear);
grade = student[0].per+student[1].per+student[2].per;
printf("\nOverall Grade:%f",(grade/3));
}
output
Thankyou
ReplyDeleteWow nice content really loved it
ReplyDeleteAish sk bhai gi tang jinu
ReplyDeleteCPL101 topper mey tey
ReplyDeleteAmama indeed a great one! I recommend you to buy domain and hosting for SEO thankyou
ReplyDelete