Pattern-19
Posted on May 23, 2021by HI_TECH SK with No comments
Pattern19
Pattern-18
Posted on May 23, 2021by HI_TECH SK with 1 comment
Pattern18
Pattern-17
Posted on May 22, 2021by HI_TECH SK with No comments
Pattern17
Pattern-16
Posted on May 22, 2021by HI_TECH SK with No comments
Pattern16
Pattern-15
Posted on May 22, 2021by HI_TECH SK with No comments
Pattern15
Pattern-14
Posted on May 22, 2021by HI_TECH SK with No comments
Pattern14
Pattern-13
Posted on May 22, 2021by HI_TECH SK with No comments
Pattern13
Pattern-12
Posted on May 22, 2021by HI_TECH SK with No comments
Pattern12
Pattern-11
Posted on May 22, 2021by HI_TECH SK with No comments
Pattern11
Pattern-10
Posted on May 21, 2021by HI_TECH SK with No comments
Pattern10
Pattern-9
Posted on May 19, 2021by HI_TECH SK with No comments
Pattern9
Pattern-8
Posted on May 19, 2021by HI_TECH SK with No comments
Pattern8
Pattern-7
Posted on May 19, 2021by HI_TECH SK with No comments
Pattern7
Pattern-6
Posted on May 12, 2021by HI_TECH SK with No comments
Pattern6
Pattern-5
Posted on May 12, 2021by HI_TECH SK with No comments
Pattern5
Pattern4
Posted on May 11, 2021by HI_TECH SK with No comments
Pattern4
C program using all 32 keywords available in ANSCII
Posted on May 03, 2021by HI_TECH SK with 5 comments
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
Subscribe to:
Posts (Atom)