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

Rinku privacy policy

Privacy Policy krg built the Rinku app as a Free app. This SERVICE is provided by krg at no cost and is intended for use as is. This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service. If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy. The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at Rinku unless otherwise defined in this Privacy Policy. Information Collection and Use For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information. The information that I request will be retained on your device and is not

GameStore Privacy Policy

  Privacy Policy krg built the GameStore app as a Free app. This SERVICE is provided by krg at no cost and is intended for use as is. This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service. If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy. The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at GameStore unless otherwise defined in this Privacy Policy. Information Collection and Use For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information, including but not limited to email, username. The information t

Privacy Policy For Bounce It game

  Privacy Policy Krishna Ghate built the Bounce It app as a Free app. This SERVICE is provided by Krishna Ghate at no cost and is intended for use as is. This page is used to inform visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service. If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy. The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which are accessible at Bounce It unless otherwise defined in this Privacy Policy. Information Collection and Use For a better experience, while using our Service, I may require you to provide us with certain personally identifiable information, including but not limited to nothing. The i