Binary to Octal conversion
/*
5.Program to store information of n students (name, regno, dob, m1,m2,m3,tot, avg and result)
in an array of structures and find total, average and result using function.
*/
#include< stdio.h >
//#include< conio.h >
#include< string.h >
struct students
{
int rollno, m1, m2,m3,tot;
char name[10],result[20];
float avg;
} s[10];
void main()
{
int i, n;
// clrscr();
printf("Enter the number of students : ");
scanf("%d", &n);
for(i = 0; i < n; i++)
{
printf("\nEnter the roll number : ");
scanf("%d", &s[i].rollno);
printf("\nEnter the name : ");
scanf("%s", s[i].name);
printf("\nEnter the marks in 3 subjects : ");
scanf("%d %d%d", &s[i].m1, &s[i].m2,&s[i].m3);
s[i].tot = s[i].m1 + s[i].m2+s[i].m3;
s[i].avg = s[i].tot / 2.0;
if(s[i].avg <35)
strcpy(s[i].result,"Fail");
else
if(s[i].avg >35)
strcpy(s[i].result,"Pass");
else if(s[i].avg >60)
strcpy(s[i].result,"First class");
}
printf("\nRoll No. Name \t\tSub1\t Sub2\t Sub3\t Total\t Average \t result\n\n");
for(i = 0; i < n; i++)
{
printf("%d \t %s \t\t %d \t %d \t %d \t %d \t %.2f \t %s \n", s[i].rollno,s[i].name,s[i].m1,s[i].m2,s[i].m3,s[i].tot,s[i].avg,s[i].result);
}
// getch();
}