Student
Name:Tambe
Sanjay Baban                                  
Program Name:Write a program
to accept the information of five students such as rollno,name, and address.And display the information
using structures.
#include<stdio.h>
#include<conio.h>
void
main()
{
 struct student
              
{
              
int rollno;
              
char sname[21];
              
char address[53];
              
}stud[5];
int
i;
clrscr();
printf("\n
Enter student information");
for(i=0;i<5;i++)
 {
 printf("\n Enter roll no-");
 scanf("\n %d",&stud[i].rollno);
 printf("\n Enter the student
name-");
 scanf("\n %s",stud[i].sname);
 printf("\n Enter the address-");
 scanf("\n %s",&stud[i].address);
 }
printf("\n
The student information");
for(i=0;i<5;i++)
 {
 printf("\n roll no
is-%d",stud[i].rollno);
 printf("\n name is -%s",stud[i].sname);
 printf("\n address is
-%s",stud[i].address);
 }
getch();
}
/*
Output
 Enter student information
 Enter roll no-153
 Enter the student name-sanjay
 Enter the address-baramati
 Enter roll no-149
 Enter the student name-sachin
 Enter the address-lonibhapkar
 Enter roll no-135
 Enter the student name-pramod
 Enter the address-supe
 Enter roll no-111
 Enter the student name-ranjit
 Enter the address-satara
 Enter roll no-130
 Enter the student name-chetan
 Enter the address-malegaon
 The student information
 roll no is -153
 name is -sanjay
 address is -baramati
 roll no is -149
 name is -sachin
 address is -lonibhapkar
 roll no is -135
 name is -pramod
 address is -supe
 roll no is -111
 name is -ranjit
 address is -satara
 roll no is -130
 name is -chetan
 address is –malegaon */
Student
Name:Tambe
Sanjay Baban                        Roll No:153
Program Name:
Write
a program to accept the information such as roll no, name, 3subjects.
Calculate total, average and display information in descending order of marks. 
#include<stdio.h>
#include<conio.h>
void
main()
{
struct
student
   {
   int rollno;
   char name [30];
   int mark [3];
   int total;
   float avg;
   }stud[5];
int
i,j;
struct
student temp;
clrscr();
printf("\n
enter student info");
for(i=0;i<5;i++)
 {
 printf("\n enter the rollno-");
 scanf("\n %d",&stud[i].rollno);
 printf("\n enter the name-");
 scanf("\n %s",&stud[i].name);
 stud[i].total=0;
 printf("\n enter the mark-");
 for(j=0;j<3;j++)
  {
  scanf("\n
%d",&stud[i].mark[j]);
  stud[i].total=stud[i].total+stud[i].mark[j];
  stud[i].avg=stud[i].total/3;
  }
 }
for(i=0;i<5;i++)
 {
 for(j=i+1;j<3;j++)
  {
  if(stud[i].total<stud[j].total)
   {
   temp=stud[i];
   stud[i]=stud[j];
   stud[j]=temp;
   }
  }
 }
printf("\n
student info");
for(i=0;i<5;i++)
 {
 printf("\n rollno
%d",stud[i].rollno);
 printf("\n name is
%s",stud[i].name);
 printf("\n total is
%d",stud[i].total);
 printf("\n avg is %f",stud[i].avg);
 }
getch();
}
/*
Output
 enter student info
 enter the rollno-153
 enter the name-Sanjay
 enter the mark-57
            58
                            68
 enter the rollno-149
 enter the name-Sachin
 enter the mark-68
                            59
                            74
 enter the rollno-121
 enter the name-Subham
 enter the mark-55
                            75
                            68
enter the
rollno-148
 enter the name-Pramod
 enter the mark-52
                            84 
                            70
 enter the rollno-142
 enter the name-Omkar
 enter the mark-54
                            63
                            67
 student info
 rollno 153
 name is Sanjay
 total is 223
 avg is 74.000000
 rollno 149
 name is Sachin
 total is 222
 avg is 74.000000
 rollno 121
 name is Subham
 total is 198
 avg is 66.000000
 rollno 148
 name is Pramod
 total is 206
 avg is 68.000000
 rollno 142
 name is Omkar
 total is 184
 avg is 61.000000 */
Student
Name:Tambe
Sanjay Baban                       Roll No:153
Program Name: Write
a program to student structure and display record in ascending order of student name.
#include<stdio.h>
#include<conio.h>
#include<string.h>
void
main()
{
struct
student
             
{
             
int rollno;
             
char name[21];
             
char address[53];
             
}stud[5];
int
i,j;
struct
student temp;
clrscr();
printf("\nEnter
the student info-");
for(i=0;i<5;i++)
 {
 printf("\n Enter student roll no-");
 scanf("\n %d",&stud[i].rollno);
 printf("\n Enter student name-");
 scanf("\n %s",&stud[i].name);
 printf("\n Enter the address-");
 scanf("\n %s",&stud[i].address);
 }
 for(i=0;i<5;i++)
  {
  for(j=i+1;j<5;j++)
   {
   if(strcmp(stud[i].name,stud[j].name)>0)
            {
            temp=stud[i];
            stud[i]=stud[j];
            stud[j]=temp;
            }
   }
  }
printf("\n
The Student information -");
printf("\n
ROLLNO \t NAME \t ADDRESS");
for(i=0;i<5;i++)
 {
 printf("\n %d \t %s \t
%s",stud[i].rollno,stud[i].name,stud[i].address);
 }
getch();
}
/*Output
 Enter the student info-
Enter student
roll no-153
 Enter student
name-Sanjay Enter the address-Baramati
 Enter student roll no-149
 Enter student name-Mahesh
 Enter the address-Pune
 Enter student roll no-108
 Enter student name-Akshay
 Enter the address-Malegoan
 Enter student roll no-135
 Enter student name-Pramod
 Enter the address-Supe
 Enter student roll no-142
 Enter student name-Omkar
 Enter the address-Indapur
The Student
information -
 ROLLNO         
NAME        ADDRESS
 108                    Akshay           Malegoan
 149                   Mahesh            Pune
 142                   Omkar  
         Indapur
 135                   Pramod            Supe
 153                   Sanjay             Baramati      */
Student Name:Tambe Sanjay Baban                 Roll
No:153
program name:menu driven program for
                               - Add book information
                               - Display book information
                              
-List all books of given author
                               -List the count of books in
the library
#include<stdio.h>
#include<conio.h>
#include<string.h>
 void main()
 {
  struct book
  {
  int bno;
  char bname[20];
  char author[20];
  };
  struct book b[20];
  int i,n,ch;
  char name[20],c;
  clrscr();
   while(1)
            {
            printf("\n
menues");
            printf("\n
1.Add book information");
            printf("\n
2.display book information");
            printf("\n
3.list all boooks of given author");
            printf("\n
4.list the count of books in this library");
            printf("\n
5. exit from program");
            printf("\n
Enter your choice=");
            scanf("%d",&ch);
            switch(ch)
                        {
case 1: printf("\n How
many info.you want to add=");
                                    scanf("\n
%d",&n);
                                    for(i=0;i<n;i++)
                                    {
                                    printf("Enter
the book.no=");
                                    scanf("\n
%d",&b[i].bno);
                                    printf("Enter
the book name=");
                                    scanf("\n
%s",&b[i].bname);
                                    printf("Enter
the author name=");
                                    scanf("\n
%s",&b[i].author);
                                    }
                           break;
            case 2:
                           printf("\n  BNO\t BOOKNAME\tBOOKAUTHOR");
                                    for(i=0;i<n;i++)
                                    printf("\n
%d\t%s\t%s",b[i].bno,b[i].bname,b[i].author);
                                    break;
            case 3:
                                    printf("Enter
the author name you want=");
                                    scanf("%s",&name);
                                    printf("\n
book information");
                                    printf("\n
BNO\t BOOKNAME\tBOOKAUTHOR");
                                    for(i=0;i<n;i++)
                                     {
                                    if(strcmp(name,b[i].author)==0)
                                     {
                                                printf("\n%d\t
%s\t %s",b[i].bno,b[i].bname,b[i].author);
                                     }
                                    }
                                    break;
             case 4:
                                    printf("The
number of book in liabrary are=%d",n);
                                    break;
 case 5: exit(0);
   default
:printf("\nEnter you correct choice");
            }
            }
            getch();
  }
/*
Output
menues                
 1.Add book information
 2.display book information
 3.list all boooks of given author
4.list the count of books in this
library
5. exit from program
 Enter your choice=1
 How many info.you want to add=2
Enter the book.no=101
Enter the book name=cprogramming
Enter the author name=verma
Enter the book.no=102
Enter the book name=statistics
Enter the author name=patil
 menues
 1.Add book information
 2.display book information
 3.list all boooks of given author
 4.list the count of books in this library
 5. exit from program
 Enter your choice=2
 
BNO    BOOKNAME       BOOKAUTHOR
 101   
cprogramming            verma
 102   
statistics                        patil
 menues
 1.Add book information
 2.display book information
 3.list all boooks of given author
 4.list the count of books in this library
 5. exit from program
Enter your choice=3
Enter the author name you
want=patil
 book information
 BNO    
BOOKNAME       BOOKAUTHOR
102     statistics                       patil
 menues
 1.Add book information
 2.display book information
 3.list all boooks of given author
 4.list the count of books in this library
 5. exit from program
 Enter your choice=4
The number of book in liabrary
are=2
 menues
 1.Add book information
 2.display book information
 3.list all boooks of given author
 4.list the count of books in this library
 5. exit from program
 Enter your choice=5             */
Student
Name:Tambe
Sanjay Baban                                              
Program
Name: Write a program to create customer
structure fields are accno, custname,balance.Display the customer details
whose balance below rs.100 using function.
#include<stdio.h>
#include<conio.h>
struct
customer
          {
            int accno;
            char name[20];
            int balance;
           }cust[5];
void
display(struct customer[5]);
void
main()
{
struct
customer c[5];
clrscr();
display(c);
getch();
}
void
display(struct customer cust[5])
{
int
i;
             
printf("\n enter customer information");
   for(i=0;i<5;i++)
   {
            printf("\n enter the account
no:");
            scanf("%d",&cust[i].accno);
            printf("\n enter the custmer
name:");
            scanf("%s",&cust[i].name);
            printf("\n enter the
balance:");
            scanf("%d",&cust[i].balance);
            }
            for(i=0;i<5;i++)
            {
if(cust[i].balance<100)
{
printf("\n\t%d",cust[i].accno);
printf("\t%s",cust[i].name);
}
}
}
 /* Output
enter the
account no:10021
enter the
custmer name:Sanjay
enter the
balance:51000
enter the
account no:50002
enter the
custmer name:Swapnil
enter the
balance:60000
enter the
account no:60506
enter the
custmer name:makarand
enter the
balance:75000
enter the
account no:40005
enter the
custmer name:Pramod
enter the
balance:81000
enter the
custmer name:Ajit
enter the
balance:51000
 10021              Sanjay
50002              Swapnil
60506               makarand
40005              Pramod
30008              Ajit      */
 
