C Language - Structures

 



#include <stdio.h>

#include <conio.h>

#include <string.h>


struct student

{

int roll_no;

int marks;

char name[50];

};


struct student Ali, Shan, Zarar;


int main()

{

Ali.roll_no = 1;

Shan.roll_no = 2;

Zarar.roll_no = 3;

Ali.marks = 435;

Shan.marks = 424;

Zarar.marks = 419;


printf ( "Roll no. 1 is Ali and he got 1st Position and %s\n", Ali.name);

printf ("Ali has got %d marks\n", Ali.marks);

printf ("\n");

printf ( "Roll no. 2 is Shan and he got 2nd Position and %s\n", Shan.name);

printf ("Shan has got %d marks\n", Shan.marks);

printf ("\n");


printf ( "Roll no. 3 is Zarar and he got 3rd Position and %s\n", Zarar.name);

printf ("Zarar has got %d marks\n", Zarar.marks);

return 0;

}


// ScreenShots:







Comments

Popular Posts