Scan to open on your phone
Point a camera at the QR code - it opens this exact paste, no app needed.
https://codepastes.com/zzgrrm14cpg1xtt6BlaPlain Text
#include <stdio.h>
#include <conio.h>
struct Student
{
int rno;
char name[10];
float marks;
};
void main()
{
struct Student s[5], temp;
int i, j, rs, flag = 0;
clrscr();
printf("\nEnter Rollno, Name and Marks of 5 Students");
for(i = 0; i < 5; i++)
{
scanf("%d %s %f", &s[i].rno, s[i].name, &s[i].marks);
}
// Sort the records
for(i = 0; i < 4; i++)
{
for(j = i + 1; j < 5; j++)
{
if(s[i].rno > s[j].rno)
{
temp = s[i];
s[i] = s[j];
s[j] = temp;
}
}
}
printf("\nRollno\tName\tMarks");
for(i = 0; i < 5; i++)
{
printf("\n%d\t%s\t%.2f", s[i].rno, s[i].name, s[i].marks);
}
printf("\nEnter rollno to be searched: ");
scanf("%d", &rs);
for(i = 0; i < 5; i++)
{
if(s[i].rno == rs)
{
flag = 1;
printf("\nStudent Found!");
printf("\nRollno: %d", s[i].rno);
printf("\nName: %s", s[i].name);
printf("\nMarks: %.2f", s[i].marks);
break;
}
}
if(flag == 0)
{
printf("\nStudent Not Found!");
}
getch();
}1,237 chars · codepastes.com