Lab9 SNB
Lab9 SNB
Lab9 SNB
LAB 9
SOURCE CODE
#include<stdio.h>
OUTPUT
2. Compute sum of the elements stored in an array using pointers and user defined function.
SOURCE CODE
#include<stdio.h>
OUTPUT
3. Write a program to create a structure named company which has name, address, phone and
no. of Employee as member variables. Read name of company, its address, phone and no. of
Employee. Finally display these members’ value.
SOURCE CODE
#include<stdio.h>
#include<string.h>
struct company{
char name[100];
char address[4][100];
char phone_number[10];
int no_of_employee;
};
int main(){
struct company c1;
gets(c1.name);
//enter address of the company
for(int i=0;i<4;i++){
gets(c1.address[i]);
}
gets(c1.phone_number);
scanf("%d",&c1.no_of_employee);
//displaying the details of the company
printf("name of the company :");
puts(c1.name);
printf("ADDRESS OF THE COMPANY \n");
printf("location:");
puts(c1.address[0]);
printf("city:");
puts(c1.address[1]);
printf("state :");
puts(c1.address[2]);
printf("pincode :");
puts(c1.address[3]);
printf("phone number of the comany :");
puts(c1.phone_number);
printf("no of employee %d ",c1.no_of_employee);
return 0;
}
OUTPUT