Pages

Sunday 3 March 2019

Program to illustrate student information using structure

 Program to illustrate student information using structure

#include <stdio.h>
struct student
{
   // defining a structure
   char name[33];
   int sno,sub1,sub2;
   float tot;
} s;

int main()
{
   printf("\n Enter student number :");
   scanf("%d",&s.sno);
   printf("\n Enter student name :");
   scanf("%s",s.name);
   printf("\n Enter student mark in subject1 :");
   scanf("%d",&s.sub1);
   printf("\n Enter student mark in subject2 :");
   scanf("%d",&s.sub2);
   s.tot = s.sub1 + s.sub2;
   printf("\n Total marks = %f ",s.tot);
   return 0;
}

output:


No comments:

Post a Comment

Programs in turboc3 : Files

File Handling in C File Handling concept in C language is used for store a data permanently in computer. Using this concept we can store our...