SlideShare a Scribd company logo
S2-1
Write a program in ‘C’ language, which accepts Enrolment number,
Name Aggregate marks secured in a Program by a student.
Assign ranks to students according to the marks secured.
Rank-1 should be awarded to the students who secured the
highest marks and so on. The program should print the
enrolment number, name of the student and the rank
secured in ascending order.
#include<stdio.h>
#include<conio.h>
struct stud
{
int roll;
int mark;
char name[15];
};
void main()
{
struct stud S[10], t;
int i, j, n;
clrscr();
printf("Enter number of studentsn");
scanf("%d",&n);
for(i=0;i<n;++i)
{
printf("Enter roll no., name, markn");
scanf("%d%s%d",&S[i].roll,&S[i].name,&S[i].mark);
}
for(i=0;i<n-1;i++)
for(j=i+1;j<n-1;j++)
if(S[i].mark < S[j].mark)
{
t=S[i];
S[i]=S[j];
S[j]=t;
}
printf("nRank Listnn");
printf("Roll No Name Mark Rankn");
for(i=0;i<n;++i)
printf("%dt%st%dt%dn",S[i].roll,S[i].name,S[i].mark,i+1);
getch();
}
Page 1

More Related Content

What's hot (16)

PDF
Bcsl 033 data and file structures lab s1-1
Dr. Loganathan R
 
PDF
Implement a queue using two stacks.
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s5-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s5-2
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s1-4
Dr. Loganathan R
 
PPTX
C Programming Example
University of Potsdam
 
PDF
C Programming Example
PRATHAMESH DESHPANDE
 
DOCX
1 (1)
Krish Na
 
DOCX
Dti2143 lab sheet 9
alish sha
 
DOC
Add digits of number in c
mohdshanu
 
DOC
C program to check leap year
mohdshanu
 
PPTX
Computer programing w
cexpertise
 
Bcsl 033 data and file structures lab s1-1
Dr. Loganathan R
 
Implement a queue using two stacks.
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s5-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s5-2
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-4
Dr. Loganathan R
 
C Programming Example
University of Potsdam
 
C Programming Example
PRATHAMESH DESHPANDE
 
1 (1)
Krish Na
 
Dti2143 lab sheet 9
alish sha
 
Add digits of number in c
mohdshanu
 
C program to check leap year
mohdshanu
 
Computer programing w
cexpertise
 

Similar to Bcsl 033 data and file structures lab s2-1 (20)

PDF
C programs Set 3
Koshy Geoji
 
DOCX
C file
simarsimmygrewal
 
DOCX
C programs
Lakshmi Sarvani Videla
 
PDF
Basic C Programming Lab Practice
Mahmud Hasan Tanvir
 
PDF
Arrays and function basic c programming notes
GOKULKANNANMMECLECTC
 
PPT
array.ppt
DeveshDewangan5
 
PDF
arraysfor engineering students sdf ppt on arrays
ruvirgandhi123
 
PPTX
C-Arrays & Strings (computer programming).pptx
yusuph2410
 
PDF
Programming For Problem Solving Lecture Notes
Sreedhar Chowdam
 
PDF
C programs
Koshy Geoji
 
PPTX
Lecture_on_string_manipulation_functions.pptx
ABHISRIVASTAV9
 
PDF
C- Programming Assignment 3
Animesh Chaturvedi
 
PPT
Unit4
mrecedu
 
PPT
C Language Unit-4
kasaragadda srinivasrao
 
PPTX
basics of c programming for naiver.pptx
ssuser96ba7e1
 
PPTX
C_Arrays.pptx
Debasis Dwibedy
 
PPT
Unit3 jwfiles
mrecedu
 
PPT
C Language Unit-3
kasaragadda srinivasrao
 
PDF
DS LAB MANUAL.pdf
Selvaraj Seerangan
 
PDF
C- Programming Assignment 4 solution
Animesh Chaturvedi
 
C programs Set 3
Koshy Geoji
 
Basic C Programming Lab Practice
Mahmud Hasan Tanvir
 
Arrays and function basic c programming notes
GOKULKANNANMMECLECTC
 
array.ppt
DeveshDewangan5
 
arraysfor engineering students sdf ppt on arrays
ruvirgandhi123
 
C-Arrays & Strings (computer programming).pptx
yusuph2410
 
Programming For Problem Solving Lecture Notes
Sreedhar Chowdam
 
C programs
Koshy Geoji
 
Lecture_on_string_manipulation_functions.pptx
ABHISRIVASTAV9
 
C- Programming Assignment 3
Animesh Chaturvedi
 
Unit4
mrecedu
 
C Language Unit-4
kasaragadda srinivasrao
 
basics of c programming for naiver.pptx
ssuser96ba7e1
 
C_Arrays.pptx
Debasis Dwibedy
 
Unit3 jwfiles
mrecedu
 
C Language Unit-3
kasaragadda srinivasrao
 
DS LAB MANUAL.pdf
Selvaraj Seerangan
 
C- Programming Assignment 4 solution
Animesh Chaturvedi
 
Ad

More from Dr. Loganathan R (17)

PDF
Ch 6 IoT Processing Topologies and Types.pdf
Dr. Loganathan R
 
PDF
IoT Sensing and Actuation.pdf
Dr. Loganathan R
 
PDF
Ch 4 Emergence of IoT.pdf
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s4-3
Dr. Loganathan R
 
PDF
Bcsl 033 data and file structures lab s1-2
Dr. Loganathan R
 
PPT
Introduction to Information Security
Dr. Loganathan R
 
PDF
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Dr. Loganathan R
 
PDF
Session 9 4 alp to display the current system time using dos int 21 h
Dr. Loganathan R
 
PDF
Session 9 1 alp to compute a grade using procedures
Dr. Loganathan R
 
PDF
IGNOU Assembly Language Programming
Dr. Loganathan R
 
PDF
Requirement engineering process
Dr. Loganathan R
 
PDF
MCS 012 computer organisation and assembly language programming assignment…
Dr. Loganathan R
 
PDF
Software requirements
Dr. Loganathan R
 
PDF
Software process
Dr. Loganathan R
 
PDF
Software engineering critical systems
Dr. Loganathan R
 
PDF
Software engineering socio-technical systems
Dr. Loganathan R
 
PDF
Software engineering introduction
Dr. Loganathan R
 
Ch 6 IoT Processing Topologies and Types.pdf
Dr. Loganathan R
 
IoT Sensing and Actuation.pdf
Dr. Loganathan R
 
Ch 4 Emergence of IoT.pdf
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s4-3
Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-2
Dr. Loganathan R
 
Introduction to Information Security
Dr. Loganathan R
 
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Dr. Loganathan R
 
Session 9 4 alp to display the current system time using dos int 21 h
Dr. Loganathan R
 
Session 9 1 alp to compute a grade using procedures
Dr. Loganathan R
 
IGNOU Assembly Language Programming
Dr. Loganathan R
 
Requirement engineering process
Dr. Loganathan R
 
MCS 012 computer organisation and assembly language programming assignment…
Dr. Loganathan R
 
Software requirements
Dr. Loganathan R
 
Software process
Dr. Loganathan R
 
Software engineering critical systems
Dr. Loganathan R
 
Software engineering socio-technical systems
Dr. Loganathan R
 
Software engineering introduction
Dr. Loganathan R
 
Ad

Recently uploaded (20)

PPTX
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
PDF
Quiz Night Live May 2025 - Intra Pragya Online General Quiz
Pragya - UEM Kolkata Quiz Club
 
PPTX
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
PDF
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
PDF
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
PPTX
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
PDF
COM and NET Component Services 1st Edition Juval Löwy
kboqcyuw976
 
PPTX
ENGLISH 8 REVISED K-12 CURRICULUM QUARTER 1 WEEK 1
LeomarrYsraelArzadon
 
PDF
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
PPTX
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
PPTX
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
PPTX
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
PPTX
Connecting Linear and Angular Quantities in Human Movement.pptx
AngeliqueTolentinoDe
 
PPTX
Natural Language processing using nltk.pptx
Ramakrishna Reddy Bijjam
 
PPTX
Lesson 1 Cell (Structures, Functions, and Theory).pptx
marvinnbustamante1
 
PPTX
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
PDF
Genomics Proteomics and Vaccines 1st Edition Guido Grandi (Editor)
kboqcyuw976
 
PPTX
Life and Career Skills Lesson 2.pptxProtective and Risk Factors of Late Adole...
ryangabrielcatalon40
 
PPTX
PLANNING A HOSPITAL AND NURSING UNIT.pptx
PRADEEP ABOTHU
 
PPTX
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 
How to Setup Automatic Reordering Rule in Odoo 18 Inventory
Celine George
 
Quiz Night Live May 2025 - Intra Pragya Online General Quiz
Pragya - UEM Kolkata Quiz Club
 
Exploring Linear and Angular Quantities and Ergonomic Design.pptx
AngeliqueTolentinoDe
 
TLE 8 QUARTER 1 MODULE WEEK 1 MATATAG CURRICULUM
denniseraya1997
 
I3PM Case study smart parking 2025 with uptoIP® and ABP
MIPLM
 
How to Configure Refusal of Applicants in Odoo 18 Recruitment
Celine George
 
COM and NET Component Services 1st Edition Juval Löwy
kboqcyuw976
 
ENGLISH 8 REVISED K-12 CURRICULUM QUARTER 1 WEEK 1
LeomarrYsraelArzadon
 
DIGESTION OF CARBOHYDRATES ,PROTEINS AND LIPIDS
raviralanaresh2
 
Aerobic and Anaerobic respiration and CPR.pptx
Olivier Rochester
 
PLANNING FOR EMERGENCY AND DISASTER MANAGEMENT ppt.pptx
PRADEEP ABOTHU
 
The Gift of the Magi by O Henry-A Story of True Love, Sacrifice, and Selfless...
Beena E S
 
Connecting Linear and Angular Quantities in Human Movement.pptx
AngeliqueTolentinoDe
 
Natural Language processing using nltk.pptx
Ramakrishna Reddy Bijjam
 
Lesson 1 Cell (Structures, Functions, and Theory).pptx
marvinnbustamante1
 
Elo the Hero is an story about a young boy who became hero.
TeacherEmily1
 
Genomics Proteomics and Vaccines 1st Edition Guido Grandi (Editor)
kboqcyuw976
 
Life and Career Skills Lesson 2.pptxProtective and Risk Factors of Late Adole...
ryangabrielcatalon40
 
PLANNING A HOSPITAL AND NURSING UNIT.pptx
PRADEEP ABOTHU
 
How to Configure Taxes in Company Currency in Odoo 18 Accounting
Celine George
 

Bcsl 033 data and file structures lab s2-1

  • 1. S2-1 Write a program in ‘C’ language, which accepts Enrolment number, Name Aggregate marks secured in a Program by a student. Assign ranks to students according to the marks secured. Rank-1 should be awarded to the students who secured the highest marks and so on. The program should print the enrolment number, name of the student and the rank secured in ascending order. #include<stdio.h> #include<conio.h> struct stud { int roll; int mark; char name[15]; }; void main() { struct stud S[10], t; int i, j, n; clrscr(); printf("Enter number of studentsn"); scanf("%d",&n); for(i=0;i<n;++i) { printf("Enter roll no., name, markn"); scanf("%d%s%d",&S[i].roll,&S[i].name,&S[i].mark); } for(i=0;i<n-1;i++) for(j=i+1;j<n-1;j++) if(S[i].mark < S[j].mark) { t=S[i]; S[i]=S[j]; S[j]=t; } printf("nRank Listnn"); printf("Roll No Name Mark Rankn"); for(i=0;i<n;++i) printf("%dt%st%dt%dn",S[i].roll,S[i].name,S[i].mark,i+1); getch(); } Page 1