Skip to main content

Student database creation using c language | BLOG |


How to create a program using c language which will store information about students and you can add another students after also and you will be able to search student by his/her roll no.?

ANS:- Here is the code 


(Tip:- Make sure to compile this code and do practice a lot to gain knowledge about programming )


#include<stdio.h>
struct student
{
char name[50];
int roll;
float marks;
};
int main()
{
int i,num,n,choice,flag,j,p,z,ch,r=0,c;
struct student s[50];
do
{
printf("enter the process 1:ADD 2:diplay 3:search ");
    scanf("%d",&ch);
switch(ch)
{
case 1:  
printf("enter no of student\n");
scanf("%d",&z);
r=r+z;
p=r;
printf("enter info\n");
for(i=0;i<p;i++)
{
printf("enter name\n");
scanf("%s",s[i].name);
printf("enter roll no\n");
scanf("%d",&s[i].roll);
printf("enter marks\n");
scanf("%f",&s[i].marks);
}
break;
case 2 :
printf("displaying info\n");
for(i=0;i<p;i++)
{
printf("\n name %s \n",s[i].name);
printf("\n roll %d \n",s[i].roll);
printf("\n marks %f \n",s[i].marks);
}
break;
case 3:   
printf("searching info\n");
printf("enter no\n");
scanf("%d",&num);
for(i=0;i<p;i++)
{
if(num == s[i].roll)
      {
printf("\n name %s \n",s[i].name);
printf("\n roll %d \n",s[i].roll);
printf("\n marks %f \n",s[i].marks);
}
else
{
printf("record not found\n");
}
}
break;
}
printf("Do you want to continue 1-yes 2-no");
scanf(" %d",&c);
}while(c==1);
printf("exit \n");
return 0;

}


used content :-

  • c language 
  • do - while loop
  • for loop
  • main function
  • if else statements


THANK YOU 


LIKE ,SHARE, COMMENT  TO GET MORE INFORMATION

Comments

Popular posts from this blog

Idle Solar Defence Policy

  Privacy Policy This privacy policy applies to the Idle Solar Defence app (hereby referred to as "Application") for mobile devices that was created by krg (hereby referred to as "Service Provider") as a Free service. This service is intended for use "AS IS". Information Collection and Use The Application collects information when you download and use it. This information may include information such as Your device's Internet Protocol address (e.g. IP address) The pages of the Application that you visit, the time and date of your visit, the time spent on those pages The time spent on the Application The operating system you use on your mobile device The Application does not gather precise information about the location of your mobile device. The Service Provider may use the information you provided to contact you from time to time to provide you with important information, required notices and marketing promotions. For a better experience, while using ...

Surf Evolution Privacy Policy

  Privacy Policy This privacy policy applies to the Surf Evolution app (hereby referred to as "Application") for mobile devices that was created by Lazy Galaxy (hereby referred to as "Service Provider") as a Free service. This service is intended for use "AS IS". Information Collection and Use The Application collects information when you download and use it. This information may include information such as Your device's Internet Protocol address (e.g. IP address) The pages of the Application that you visit, the time and date of your visit, the time spent on those pages The time spent on the Application The operating system you use on your mobile device The Application does not gather precise information about the location of your mobile device. The Service Provider may use the information you provided to contact you from time to time to provide you with important information, required notices and marketing promotions. For a better experience, while us...

Chicken Cartel Privacy Policy

  Privacy Policy This privacy policy applies to the Chicken Cartel app (hereby referred to as "Application") for mobile devices that was created by (hereby referred to as "Service Provider") as a Free service. This service is intended for use "AS IS". Information Collection and Use The Application collects information when you download and use it. This information may include information such as Your device's Internet Protocol address (e.g. IP address) The pages of the Application that you visit, the time and date of your visit, the time spent on those pages The time spent on the Application The operating system you use on your mobile device The Application does not gather precise information about the location of your mobile device. The Service Provider may use the information you provided to contact you from time to time to provide you with important information, required notices and marketing promotions. For a better experience, while using the Appl...