Write a c program to create student structure having field roll_no, stud_name, mark1, mark2, mark3 calculate the total and average of marks and arrange the records in descending order of marks

#include<stdio.h>
#include<conio.h>
void main()
{
struct student
{
int rollno;
char name[20];
int m1,m2,m3;
float percent;
};
struct student s[20],t;
int i,j,n;
clrscr();
printf("\n enter the limit");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n enter the roll no\n");
scanf("%d",&s[i].rollno);
printf("\n enter the name \n");
scanf("%s",s[i].name);
printf("\n enter the mark=");
scanf("%d",&s[i].m1);
printf("\n enter the mark=");
scanf("%d",&s[i].m2);
printf("\n enter the mark=");
scanf("%d",&s[i].m3);
s[i].percent=(s[i].m1+s[i].m2+s[i].m3)/3;
}
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(s[i].percent<s[j].percent)
{
t=s[i];
s[i]=s[j];
s[j]=t;
}
}
}
printf("\n display in desending order\n");
for(i=0;i<n;i++)
{
printf("\n rollno=%d",s[i].rollno);
printf("\n name=%s",s[i].name);
printf("\n mark1=%d",s[i].m1);
printf("\n mark2=%d",s[i].m2);
printf("\n mark3=%d",s[i].m3);
printf("\n percent=%f",s[i].percent);
}
getch();
}

Comments

  1. hi sir.my question isWrite a c program to create student structure having field roll_no, stud_name, mark1, mark2, mark3 calculate the total and average,result of marks and arrange the records in descending order of marks in files concept in c language.

    ReplyDelete
  2. sir plz i dont understand files concept i even write on this program
    #include
    #include
    void main()
    {
    FILE *fp;

    char name[1000][20],na[1000][20];
    int a[1000][5],b[1000][5];
    int i,j,n,flag=0,total=0;
    char grade[10]="---";
    char result[10]="pass";
    float avg=0.0;
    int roll[100],r[100];
    clrscr();
    fp=fopen("s.txt","w");
    if(fp==NULL)
    printf("error ");
    else
    {
    printf("\nhow many students data you have to enter ");
    scanf("%d",&n);

    for(i=0;i100 || a[i][j]<0)
    {
    printf("\nmarks should be between 0 to 100 only re enter it");
    printf("enter %d subject marks ",i+1);
    scanf("%d",&a[i][j]);
    }
    }
    fprintf(fp,"%d %s %d %d %d %d %d %d",roll[i],name[i],a[i][0],a[i][1],a[i][2],a[i][3],a[i][4],a[i][5]);
    fprintf(fp,"%c",'\n');
    }
    clrscr();
    fclose(fp);
    fp=fopen("s.txt","r");

    printf("\nno name s1 s2 s3 s4 s5 s6 tot avg res grd");
    printf("\n-----------------------------------------------------------");
    for(i=0;i=60.00 && avg<=100.00)
    strcpy(grade,"first");
    if(avg>=50.00 && avg<=59.99)
    strcpy(grade,"second");
    if(avg>=35.00 && avg<=49.99)
    strcpy(grade,"third");
    }
    fprintf(stdout,"%d %s %d %d %d %d %d %d %d %.2f %s %s",r[i],na[i],b[i][0],b[i][1],b[i][2],b[i][3],b[i][4],b[i][5],total,avg,result,grade);
    }
    }
    getch();
    }
    is this program is correct or not.any mistakes plz correct sir.send me reply plz

    ReplyDelete
  3. i want algorithm and flow chart for this question pls help me


    create a structure(roll no,name'marks in three subject,percentage).accept details of n students and write a menu driven programs the following differnt options.
    1-search
    2-modify
    3-display all student details
    4- display all student having percentage>_
    5-display all student having maximum percentage

    ReplyDelete
  4. Sir. my question is WAP to process student structure containing roll number, class and age as members. The program must read 5 student record in an array of structure and display the details of a student who is eldest. Use a function to find the eldest for which array of structure is an argument in c language.

    ReplyDelete
  5. take a structure that stores details of student 3 functions one input one for output one calculating average and percentage

    ReplyDelete
  6. {plz solve this problem}*******************
    suppose you are asked to make a final mark sheet of 2 students. now write a program that will calculate the total marks for the indivitual student and display the marks sheet exactly in a following manner.(suppose mid1 ,mid2 are taken out of a score of 100. but you need to take only 50% on them).

    student name quiz(20%) mid1(40%) mid2(40%) total(100%)
    atif 20 40 20 80

    ReplyDelete
  7. Write a program that uses structure data type variable to store student name and ID.
    The program takes the input from user and display it.
    Make separate functions to take Input and output.
    Pass structure as function argument to input method and as well as return type in output method.

    ReplyDelete
  8. a student structure consisting of data member Rollno (integer),
    Stu_name (pointer to char) and marks (array of 3 integers). Give
    declaration for structure variable

    ReplyDelete
  9. write a program in c to display details of 100 students(marks,roll no,name) and average of their marks

    ReplyDelete
  10. wap to student inf. like name,roll no,and total marks and display the inf. of those whose total marks is more than the average marks of all student.......sir plzz help me out.....

    ReplyDelete
  11. i want answer fo this pls Store multiple records in a file. and display how many records present

    ReplyDelete
  12. Hi,
    plz can help to solve this question?

    Use an array Data Structure to store data of 30 studnts in your college. Each student record consist of following 3 fields: Integer ID, String Name, and String Major

    ReplyDelete
  13. Hi,
    plz can help to solve this question?

    Use an array Data Structure to store data of 30 studnts in your college. Each student record consist of following 3 fields: Integer ID, String Name, and String Major

    ReplyDelete
  14. sirrrrr.my question is to 1. Create a structure for 10 students with RollNo, Name and Age. Categorize the details according to their age

    ReplyDelete
  15. sirrrrr.my question is to 1. Create a structure for 10 students with RollNo, Name and Age. Categorize the details according to their age

    ReplyDelete
  16. Write a C program to accept the names and marks of 7 students in 5 subjects. Print in
    descending order the rank list based on the average of the 5 subjects. Also print the name
    of the first ranker and his percentage.

    ReplyDelete
  17. Sir My Question Is

    Write a program to create a student class which should have the following fields:
    Student Name
    Student Age
    Fee
    Total Marks
    Create 5 objects of his/her class and test the program, and
    i) Print the contents of all objects
    ii) Sort the student objects in ascending order of their total marks

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
  19. Can someone do this example?
    Define a structure named "Student" with roll no,name and percentage as members.Read data of 5 students from user and display them in proper format.

    ReplyDelete
  20. Write an algorithm for accepting the marks of a test out of 20 from a class of 10,sort and display the number of students with the highest mark and the number of students who scored below average.

    thats my question sir

    ReplyDelete
  21. Write a c program to accept the names and marks of 10 stdnts in 5 sub. print in descending order the rank list based on the average of the 5 sbjcts

    ReplyDelete
  22. hai sir i need a c program to store and accept studnets marks and accept a student name calculate avg and total using array minimum 5 members

    ReplyDelete
  23. create a class ''student'' having two user defined properties to read and write the student name and roll number respectively

    ReplyDelete
  24. how to create structure called student with name,age and mark of three subjects and find their total and display their result in order of their marks plzz tell me

    ReplyDelete
  25. C program to calculate the average of 5 students user should give the 5 different name of the students and every students obtain 3 different marks of the three different subject. You have to show the individual students name with their average marks and average of 5 students.


    Please solve it as soon as possible...I need it today...please help me...

    ReplyDelete
  26. Write a C program to store name, roll number, year and marks of three subjects of n students and print the student the name, roll number, average and grade based on average marks of the student using structures.



    plz solve it

    ReplyDelete
  27. write a C program to accept the names and marks of 10 students in 4 subject. Print in ascending order the rang list based on the average of the 4 subjects. if the pass mark of each subject is 35, print the name of the students that failed in all four subjects.

    ReplyDelete
  28. Create a structure named Student.
    struct Student
    {
    char name[30];
    char department[20];
    int yearOfStudy;
    float cgpa;
    };

    Include functions as specified in the code template to perform the following operations.
    1)Display names of students from a particular year
    2)Display names of students from a particular department
    3)Display all details of the student having the highest CGPA
    4)Display all details of the student from a particular department having the highest CGPA
    5)Display all details of a particular student (Search by name)
    6)Display all details of all students
    7)Update CGPA of a particular student [Update CGPA by 0.5 of the particular student]
    8)Exit

    Please note that whenever multiple records are displayed, they are displayed sorted in ascending order based on name.


    Input and Output Format:
    Refer sample input and output for formatting specifications.
    All float values are displayed correct to 2 decimal places.
    All text in bold corresponds to input and the rest corresponds to output.

    ReplyDelete
  29. Define a structure student having data member as Name, age, class and marks of 3 subjects. Accept this data for 10 students and display this data for students who are youngest?
    provided this program

    ReplyDelete
  30. This comment has been removed by the author.

    ReplyDelete
  31. This program code seems out of date. Please update.

    Thanks,
    Merient Infotech

    ReplyDelete
  32. Create a structure student with members as roll no, sname, course, division and percentage. Create following menus to display the record.

    Accept records of ‘n’ students
    Display records of ‘n’ students
    Display details of students whose course is “BSC”
    Display details of students whose percentage >=75

    ReplyDelete
  33. factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.
    factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.
    factorial hundred In the last few days, the “factorial of 100” is one of the top subjects and a lot of maths geeks compute it using voice assistants such as Alexa, Shiri, etc.

    ReplyDelete

Post a Comment