बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

C Structure Programming Exam Question With Answer

C Structure important Programming Exam Question With Answer



Write a Structure C  program to generate score card of cricket match, which will accept name of player, number of balls played, number of runs scored, and wickets taken. Display the details of player having highest wicket taken




#include<stdio.h>
#include<conio.h>
void main()
{
 struct cricket  { char name[20];
                         int teamno;
                        int player_no;
                        int no_of_runs;
                        int no_of_wicket;
                       };
 struct cricket t[20] ;
 int n,i,max,pos=0;
 clrscr();
 printf("\n how many teams:");
 scanf("%d",&n);
 printf("\n------------ Enter the player Details-------------------\n");
 for(i=0;i<n;i++)
 { printf("\n EnterThe Name:");
   fflush(stdin);
   gets(t[i].name);
   fflush(stdin);
   printf("\n Enter the team no :");
   scanf("%d",&t[i].teamno);
   printf("\n Enter the Player no :");
   scanf("%d",&t[i].player_no);
   printf("\n Enter no of runs :");
   scanf("%d",&t[i].no_of_runs);
   printf("\n Enter no of wicket:");
   scanf("%d",&t[i].no_of_wicket);
   printf("\n-------------------------------------------------------\n");
 }
 max=t[0].no_of_wicket;
 for(i=0;i<n;i++)
 {
   if(max<t[i].no_of_wicket)
   {   max=t[i].no_of_wicket;
         pos=i;
   }
 }
  printf("\n\n\n_____________Highest Wicket Takes_____________________\n");
   printf("\n\t Name:%s",t[pos].name);
   printf("\n\t team no :%d",t[pos].teamno);
   printf("\n\t Player no :%d",t[pos].player_no);
   printf("\n\t runs :%d",t[pos].no_of_runs);
   printf("\n\t wicket:%d",t[pos].no_of_wicket);
   printf("\n----------------------------------------------------------\n");
getch();
}



write a c program using structure

Accept information of 5 students in an array of structure with fields roll_no, name and marks. Print name of the student getting highest marks. 



#include<stdio.h>
#include<conio.h>
 void main()
 {
 struct std
 {
    char nm[20];
 int rno,mk;
 };
 struct std s[5];
 int i,max,pos;

 clrscr();
 for(i=1;i<=5;i++)
 {
    printf("enter a roll no");
 scanf("%d",&s[i].rno);
 printf("enter a name");
 scanf("%s",s[i].nm);

 printf("enter a total marks");
 scanf("%d",&s[i].mk);

 }
 for(i=1;i<=5;i++)
 {
 printf("\n\n roll no=%d\n name=%s\nmark=%d\n\n",s[i].rno,s[i].nm,s[i].mk);
 }
  max=s[0].mk;
 for(i=1;i<=5;i++)
 {

      if(max<s[i].mk)
      {
      max=s[i].mk;

      pos=i;
      }
      }
      printf("\n*********************************\n");
      printf("\nlargest mark student detail ---\n");

      printf("\n roll no=%d",s[pos].rno);

      printf("\n student name=%s",s[pos].nm);
      printf("\n marks=%d",s[pos].mk);



 getch();
 }



write a c program using structure

Write a program to accept data about restaurant dishes and display dish details with lowest calories. Consider dish structure as – dish(no, name, type, calories.)



#include<stdio.h>
#include<conio.h>
void main()
{ struct dish{  int no;
                char name[20];


                char type[20];
                float cal;
              };
                 struct dish a[20];
             int i,n,pos,max;
             clrscr();
             printf("\n how many dishes: ");
             scanf("%d",&n);

             printf("\n \t Enter the dish details:\n  ");
             for(i=0;i<n;i++)
             { printf("\t enter the dish no :");
             scanf("%d",&a[i].no);
             printf("\t enter the Dish name : ");
             scanf("%s",a[i].name);
             printf("\t enter the Dish type :");
             scanf("%s",a[i].type);
             printf("\t Enter the no of calories :");
             scanf("%f",&a[i].cal);
             printf("\n________________________________________\n");
             }
             printf("\n___________Dish Details_______________\n");
             for(i=0;i<n;i++)
             { printf("\n Dish no :%d",a[i].no);
             printf("\n Dish name :%s",a[i].name);
             printf("\n Dish type :%s",a[i].type);
             printf("\n No of calories :%f",a[i].cal);
             printf("\n________________________________________");
             }
              max=a[0].cal;
             for(i=0;i<n;i++)
             { if(max<a[i].cal)
              {
              max=a[i].cal;
              pos=i;
              }
             }
      printf("max cal Dish Detail: ") ;
      printf("\n Dish no :%d",a[pos].no);
             printf("\n Dish name :%s",a[pos].name);
             printf("\n Dish type :%s",a[pos].type);
             printf("\n No of calories :%f",a[pos].cal);
  getch();
}


void linkfloat()
{
 float a=0,*b;
 b=&a;
 a=*b;
}


write a c program using structure Accept information of 5 Employee in an array of structure with fields  name and Salary. Print name of the Employee having highest salary

 

 

 

#include<stdio.h>
#include<conio.h>
void main()
{ struct emp
  { char ename[10];
    int sal;
  } ;
  t5 struct emp e[3];
 int i;
 int max,pos=0;
  clrscr();

 for(i=0;i<3;i++)
 {
   printf("\n enter the name : ");
  scanf("%s",e[i].ename);
  printf("\n enter salary : ");
  scanf("%d",&e[i].sal);
 }
 max=e[0].sal;

 for(i=0;i<3;i++)
 {
   if(max<e[i].sal)
   {
      max=e[i].sal;
      pos=i;
   }
 }


 printf("\n maximum salaried employee details\n\n\n ");
 printf("\n salary=%d :",max);
 printf("\n name=%s",e[pos].ename);
 getch();


}
 



Cprogram99.blogspot.com helps you computer programing or basic c programm blog you find guideline to learn c programming,how to learn c language,learn c language,learn c programming online learning c language also blog contains c programming notes which helps you  learn c programming pdf ,learn c language online,learning programming learning c programming, learn c programming step by step, c programming basics notes how to learn programming in c, learn programming in c, learn c programming online free c programming learning, learn c program,learning c language online,learn programing learn c programming language,learn c programing,easy way to learn c language computer programing basics




C Program example List