Course Code and Name: 2CS101 Computer Programming Practical No: 8
Course Code and Name: 2CS101 Computer Programming Practical No: 8
Course Code and Name: 2CS101 Computer Programming Practical No: 8
Methodology followed:
#include<stdio.h>
#include<math.h>
#include<string.h>
struct Employee{
char name[20];
int salary;};
void main(){
int n = 0;
printf("Please enter no of employees\n");
scanf("%d", &n);
struct Employee e[n];
printf("Name of employee and their salary\n");
for(int i = 0; i < n; i++){
scanf("%s %d", e[i].name, &e[i].salary);
}
int s = 0;
printf("Please enter position of employee\n");
2
scanf("%d", &s);
printf("The name of employee is %s and total salary is %d", e[s - 1].name, e[s - 1].salary);
}
Input/Output :
Methodology followed:
#include<stdio.h>
#include<math.h>
#include<string.h>
struct Items{
3
char name[20];
int quantity;
int prize;
int coast};
void function(struct Items e[]){
printf("Table is given below:\n\n");
for(int i = 0; i < 5; i ++){
Input/Output :
4
Methodology followed :
#include<stdio.h>
#include<math.h>
#include<string.h>
struct complex{
int real;
int imaginary} c1, c2;
void function(struct complex c1, struct complex c2){
Input/Output :
CONCLUSIONS:
In this whole practical I learn about how to use structure. In addition I learnt how to add
complex numbers with the help of structure and also learn how to make table