//HSEB or NEB
//year 2061(2004)
/*Q.1(a).The marks obtained by studen in 7 different subjects are entered through the keyboard. The student gets a division as per the following rules:
percentage greater of equal to 60 first Division
percentage between 45 and 59 second Division
Percentage between 35 and 44 Third Division
Percentage less than 35 Fail
percentage less than 35 in a subject will be declared as Fail.
write a program using C language to process result of all students based on the specification stated above.
*/
#include<stdio.h>
void main()
{
int marks[7],i,Total=0;
float av;
printf(“enter the marks of 7 subjects:\n”);
for(i=0;i<7;i++)
{
scanf(“%d”,&marks[i]);
Total+=marks[i];
}
av=Total/7.0;
if(av>=35)
{
for(i=0;i<7;i++)
{
if(marks[i]<35)
break;
}
if(i==7)
{
if(av>=60)
{
printf(“Passed with First Division with %f percent.”,av);
}
else if(av>=45 && av<=59)
{
printf(“Passed with Second Division with %f percent”,av);
}
else
{
printf(“Passed with third division with %f percent”,av);
}
}
else
printf(“Fail”);
}
else
printf(“Fail”);
}
OUTPUT

/*Q.1(b).write a program that reads different names and addressses into computer and rearrange the names into alphabetical order using the structure variables.*/
#include<stdio.h>
#include<string.h>
#define Num 5
struct info
{
char name[25];
char address[50];
}s[Num], temp;
void main()
{
int i, j;
for(i=0; i<Num; i++)
{
printf(“\nEnter name: “);
scanf(“%s”, s[i].name);
printf(“Enter address: “);
scanf(“%s”, s[i].address);
}
printf(“/—————————————————–\n”);
printf(“Name\tAddress\n”);
for(i=0; i<Num; i++)
{
for(j=i+1; j<Num; j++)
{
if(strcmp(s[j].name, s[i].name)<0)
{
temp = s[j];
s[j] = s[i];
s[i] = temp;
}
}
printf(“%s\t%s\n”, s[i].name, s[i].address);
}
printf(“/——————————————————\n”);
}
OUTPUT

//Q.2(a)write a program using c language to read the age of 100 persons and count the number of persons in the age group between 50 to 60. Use ‘for’ and ‘continue’ statements.
#include<stdio.h>
#define max 100
void main()
{
int age[max],i,count=0;
printf(“enter the age of 100 students\n”);
for(i=0;i<max;i++)
{
scanf(“%d”,&age[i]);
if(age[i]<50 || age[i]>60)
continue;
else
count++;
}
printf(“the number of person in the age group 50 and 60 is %d:”,count);
}
