# include<stdio.h>
# include<string.h>
struct employee{
int code;
float salary;
char name[15];
};
int main(){
struct employee e1,e2,e3;
printf("enter the employee Id ");
scanf("%d", &e1.code);
printf("enter the employee salary ");
scanf("%f", &e1.salary);
printf("enter the employee name ");
scanf("%s", &e1.name);
printf("enter the employee Id ");
scanf("%d", &e2.code);
printf("enter the employee salary ");
scanf("%f", &e2.salary);
printf("enter the employee name ");
scanf("%s", &e2.name);
printf("enter the employee Id ");
scanf("%d", &e3.code);
printf("enter the employee salary ");
scanf("%f", &e3.salary);
printf("enter the employee name ");
scanf("%s", &e3.name);
return 0;
}
# include<stdio.h>
# include<string.h>
struct employees{
int code;
float salary;
char name[15];
};
void show(struct employees e){
printf("employees id is %d\n",e.code);
printf("employees salary is %f\n",e.salary);
printf("employees name is %s\n",e.name);
}
int main(){
struct employees e1={100,123.25,"Upendra"};
show(e1);
return 0;
}
#include <stdio.h>
#include<string.h>
struct employees
{
int code;
float salary;
char name[15];
};
int main()
{
struct employees e1;
struct employees *ptr = &e1;
ptr->code = 120;
ptr->salary = 120.254;
strcpy(ptr->name,"Upendra");
printf("employees id is %d \n",e1.code);
printf("employees id is %f \n",e1.salary);
printf("employees id is %s \n",e1.name);
return 0;
}
#include <stdio.h>
#include <string.h>
struct employees
{
int code;
float salary;
char name[50];
};
int main()
{
struct employees facebook[10];
facebook[0].code=250;
facebook[0].salary=253.25;
strcpy (facebook[0].name,"Upendra");
facebook[1].code=250;
facebook[1].salary=253.25;
strcpy (facebook[1].name,"Upendra");
facebook[2].code=250;
facebook[2].salary=253.25;
strcpy (facebook[2].name,"Upendra");
facebook[3].code=250;
facebook[3].salary=253.25;
strcpy (facebook[3].name,"Upendra");
printf("Done");
return 0;
}
# include<stdio.h>
# include<string.h>
struct employee{
int code;
float salary;
char name[15];
};
int main(){
struct employee e1;
e1.code=125;
e1.salary=256.30;
strcpy(e1.name,"Upendra");
printf("Employee id is %d\n",e1.code);
printf("Employee salary is %.2f\n",e1.salary);
printf("Employee Name is %s\n",e1.name);
return 0;
}
# include<stdio.h>
#include<string.h>
typedef struct employees
{
int code;
float salary;
char name[15];
}emp;
int main(){
emp e1;
emp *ptr = &e1;
ptr->code = 120;
ptr->salary = 120.254;
strcpy(ptr->name,"Upendra");
printf("employees id is %d \n",e1.code);
printf("employees id is %f \n",e1.salary);
printf("employees id is %s \n",e1.name);
return 0;
}
# include<stdio.h>
# include<string.h>
typedef struct student_marks{
int marks;
char name[15];
char subjects[10];
}marks;
int main(){
marks m1;
marks *ptr=&m1;
ptr->marks=45;
strcpy(ptr->subjects,"Maths");
strcpy(ptr->name,"Upendra");
printf("%d \n",m1.marks);
printf("%s \n",m1.subjects);
printf("%s \n",m1.name);
return 0;
}
# include<stdio.h>
typedef struct points_function{
float x;
float y;
}points;
void display(points p){
printf("the points are (x,y) is (%d,%d) \n ",p.x,p.y);
}
int main(){
points p[5];
for (int i = 0; i < 5; i++)
{
printf("enter the number in x axis of point %d:",i+1);
scanf("%f",&p[i].x);
printf("enter the number in y axis of point %d:",i+1);
scanf("%f",&p[i].y);
}
for (int i = 0; i < 5; i++)
{
display(p[i]);
}
return 0;
}
#include <stdio.h>
typedef struct vector
{
int x;
int y;
} vec;
vec sumVector(vec v1,vec v2){
vec results;
results.x=v1.x+v2.x;
results.y=v1.y+v2.y;
printf("the sum of x axis of vector is %d \n",results.x);
printf("the sum of y axis of vector is %d \n",results.y);
}
int main(){
vec v1, v2, sum;
v1.x = 20;
v1.y = 40;
v2.x = 10;
v2.y = 50;
sum= sumVector(v1,v2);
return 0;
}
#include <stdio.h>
typedef struct complex_no
{
int real;
int complex;
} com;
void dispaly(com c){
printf("the value of real part of complex num is %d \n", c);
printf("the value of imaginary part of complex num is %d \n", c);
}
int main()
{
com cnums[5];
for (int i = 0; i < 5; i++)
{
printf("Enter the value of real %d num:\n", i + 1);
scanf("%d",&cnums[i].real);
printf("Enter the value of imaginary %d num:\n", i + 1);
scanf("%d",&cnums[i].complex);
}
for (int i = 0; i < 5; i++)
{
dispaly(cnums[i]);
}
return 0;
}
#include <stdio.h>
#include <string.h>
typedef struct bank_account
{
int Account_number;
char Name[20];
float deposit;
char Branch[25];
} account;
void display(account *c, int b)
{
for (size_t i = 0; i < 5; i++)
{
printf("the Acount number of customer %d is: %d \n", i + 1, (*c).Account_number);
printf("the Name of customer %d is: %s \n", i + 1, (*c).Name);
printf("the Amount Desposited by of customer %d is: %f \n", i + 1, (*c).deposit);
printf("the Branch of customer %d is:%s \n", i + 1, (*c).Branch);
}
}
int main()
{
account customer[5];
for (int i = 0; i < 5; i++)
{
printf("Enter the Account number of Customer %d:\n", i + 1);
scanf("%d", &customer[i].Account_number);
printf("Enter the Name of Customer %d:\n", i + 1);
scanf("%s", &customer[i].Name);
printf("Enter the Amount Deposit by of Customer %d:\n", i + 1);
scanf("%f", &customer[i].deposit);
printf("Enter the Branch of Customer %d:\n", i + 1);
scanf("%s", &customer[i].Branch);
}
display(customer, 5);
return 0;
}
#include <stdio.h>
typedef struct timestamp
{
int date;
int month;
int year;
int hours;
int minutes;
int seconds;
} time;
void display(time c)
{
printf("the Timestamp is %d-%d-%d\t%d:%d:%d\n", c.date, c.month, c.year, c.hours, c.minutes, c.seconds);
}
int Time_comp(time c1,time c2){
if (c1.seconds>c2.seconds)
{
return 1;
}
else if (c1.seconds<c2.seconds)
{
return -1;
}
else if (c1.minutes>c2.minutes)
{
return 1;
}
else if (c1.minutes<c2.minutes)
{
return -1;
}
else if (c1.hours>c2.hours)
{
return 1;
}
else if (c1.hours<c2.hours)
{
return -1;
}
else if (c1.year>c2.year)
{
return 1;
}
else if (c1.year<c2.year)
{
return -1;
}
else if (c1.month>c2.month)
{
return 1;
}
else if (c1.month<c2.month)
{
return -1;
}
else if (c1.date>c2.date)
{
return 1;
}
else if (c1.date<c2.date)
{
return -1;
}
return 0;
}
int main()
{
time T1 = {25, 06, 2020, 12, 60, 12};
time T2 = {25, 06, 2020, 12, 60, 12};
display(T1);
display(T2);
int c = Time_comp(T1, T2);
printf("the value return after comparison is %d",c);
return 0;
}
No comments:
Post a Comment