Friday 20 January 2012

Do u have habit of bunking the classes more want to calculate and maintain ur attendence run this code it a simple code........plz do comment on this.......

#include<stdio.h>
#include<conio.h>

void main()
{
float att,tot,count=0;
float per,MIN;
clrscr();
printf("ENTER THE TOTAL NUMBER OF CLASSES TAKEN:\n");
scanf("%f",&tot);
printf("ENTER THE NUMBER OF CLASSES ATTENDED:\n");
scanf("%f",&att);
per=(att/tot)*100;
printf("PERCENTAGE=%f\n",per);
printf("MIN PERCENTAGE TO BE MAITAINED\n");
scanf("%d",&MIN);

if(per>=MIN)
printf("THE MIN ATTENDENCE ALREADY MAINTAINED\n");
else
{
while(per<MIN)
{
tot=tot+1;
att=att+1;
per=(att/tot)*100;
count=count+1;
}
printf("THE TOTAL NUMBER OF CLASSES TO BE ATTENDED CONTINUESLY TO MAINTAIN MIN(75) ATTENDENCE IS %f",count);
}
getch();
}

No comments:

Post a Comment