Posts

Showing posts from May, 2017

Display name of five students using structure in c.

if we do not use any loop in our file. then a programme will take more time and coding will be too long.  an example is following:-  #include <stdio.h> #include <stdlib.h> struct student {     char name1[50];     char name2[50];     char name3[50];     char name4[50];     char name5[50]; }s; int main() {     printf("enter name of 1s students\n");     scanf("%s",s.name1);     printf("enter name of 2 students\n");     scanf("%s",s.name2);     printf("enter name of 3 students\n");     scanf("%s",s.name3);     printf("enter name of 4 students\n");     scanf("%s",s.name4);     printf("enter name of 5 students\n");     scanf("%s",s.name5);     // displaying name     printf("displaying name of five students \n");     printf("name of 1 student : \n");     ...

calculate average marks of five students using array of structure in c.

#include<stdio.h>         struct student         {           int sub1;           int sub2;           int sub3;           int sub4;           int sub5;         };             void main()         {              struct student s[10];              int i,j,fn,sum=0,total=0;              float a;              for(i=0;i<=4;i++)                  {                         printf("\nEnter Marks in five Subjects = ");                        ...