DIR Return Create A Forum - Home
---------------------------------------------------------
Class Discussion
HTML https://srm.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Programming in C++
*****************************************************
#Post#: 21--------------------------------------------------
PERCENTAGE USING WHILE LOOP
DIR By: gaurav
Date: May 11, 2019, 9:04 am
---------------------------------------------------------
#include<iostream.h>
#include<conio.h>
void main ()
{
clrscr();
char name[100], course[100];
int reg, num, total, present, percentage;
cout<<"Specify the size=";
cin>>num;
while(num>=1)
{
cout<<"\t\tFILL THE DETAILS\n";
cout<<"Enter the name=";
cin>>name;
cout<<"Enter the course=";
cin>>course;
cout<<"Enter the register number=";
cin>>reg;
cout<<"Enter the number of present days=";
cin>>present;
cout<<"Enter the total number of days=";
cin>>total;
percentage=(present*100)/total;
cout<<"\t\tDETAILS\n";
cout<<"NAME="<<name<<"\n";
cout<<"COURSE="<<course<<"\n";
cout<<"REGISTER NUMBER="<<reg<<"\n";
cout<<"NUMBER OF PRESENT DAYS="<<present<<"\n";
cout<<"PERCENTAGE="<<percentage<<"\n";
num--;
if(percentage>=75)
{
cout<<"STUDENT IS NOT DETAINED!\n\n";
}
else
{
cout<<"DETAINED!\n\n";
}
}
getch();
}
*****************************************************
Page 1 of 1