Program -01
Structure Creation in C programming.
#include<stdio.h>
struct student
{
int id;
char name[100];
double result;
};
int main()
{
struct student std;
scanf("%d", &std.id);
scanf(" %s", &std.name);
scanf(" %lf", &std.result);
printf("%d %s %lf\n", std.id, std.name, std.result);
return 0;
}
Program-02
Input and Output Function for a Structure in C Programming
#include<stdio.h>
struct student{
int id;
char name[100];
double res;
int contact;
};
void input()
{
struct student s[5];
int i;
printf("Enter each student Information one by one: \n");
for(i = 0; i < 2; i++){
scanf("%d %s", &s[i].id, &s[i].name);
scanf("%lf%d", &s[i].res, &s[i].contact);
}
}
void output()
{
struct student s[5];
int i;
for(i = 0; i < 5; i++){
printf("Id: %d ", s[i].id);
printf("Name: %s ", s[i].name);
printf("Result: %lf ", s[i].res);
printf("Contact: %d\n", s[i].contact);
}
}
int main()
{
input();
output();
return 0;
}
Assalamu-Alikum
ReplyDeleteSir Apnar slite gula Ai sight ea paoa jabea na?
WaAlikumussalam Owa Rahmatullah!!!
DeleteYou will get all my lecture slides from here,
https://www.slideshare.net/AlamgirHossain109