My Profile

I, Das ShrikKrishna J. MCA III IMSCD&R, Ahmednagar.

Monday, 15 August 2011

Implement Structure with Array

Write a Program in C to implement Structure with Array
#include<stdio.h>
#include<conio.h>
struct student
{
int roll;
char name;
int maths;
};
void main()
{
struct student s[4];
int i;
clrscr();
printf("Enter Roll Number, First Character of Name and Marks\n");
for(i=0;i<=3;i++)
{
printf("\nInformation for student %d\n",i+1);
scanf("%d %c %d",&s[i].roll,&s[i].name,&s[i].maths);
}
printf("\n\nRoll Number \t Names \t\t Marks\n\n");
for(i=0;i<=3;i++)
{
printf(" %d \t %c \t\t %d\n",s[i].roll,s[i].name,s[i].maths);
}
getch();
}

No comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | cheap international calls