Structure Programming Practice in C Part-01
01. Two-Person Age and Salary Structure
#include <stdio.h> struct person { int age; float salary; }; int main() { struct person jakaria, jubayer; jakaria.age = 22; jakaria.salary = 3200.60; printf("Md Jakaria Nur\n"); printf("Age = %d Years\n", jakaria.age); printf("Salary = %.2f USD\n", jakaria.salary); jubayer.age = 24; jubayer.salary = 3400.60; printf("\nMd Jubayer Nur\n"); printf("Age = %d Years\n", jubayer.age); printf("Salary = %.2f USD\n", jubayer.salary); return 0 ; }
02. Taking Input – Two Person Age and Salary Structure
#include <stdio.h> struct person { int age; float salary; }; int main() { struct person jakaria, jubayer; printf("Enter Jakaria's Age: "); scanf("%d", &jakaria.age); printf("Enter Jakaria's Salary: "); scanf("%f", &jakaria.salary); printf("Enter Jubayer's Age: "); scanf("%d", &jubayer.age); printf("Enter Jubayer's Salary: "); scanf("%f", &jubayer.salary); printf("Md Jakaria Nur\n"); printf("Age = %d Years\n", jakaria.age); printf("Salary = %.2f USD\n", jakaria.salary); printf("\nMd Jubayer Nur\n"); printf("Age = %d Years\n", jubayer.age); printf("Salary = %.2f USD\n", jubayer.salary); return 0 ; }
03. Taking Input – Two Person Age and Salary Structure
#include <stdio.h>
struct person {
int age;
float salary; };
int main() {
struct person jakaria, jubayer;
printf("Enter Jakaria's Age: ");
scanf("%d", &jakaria.age);
printf("Enter Jakaria's Salary: ");
scanf("%f", &jakaria.salary);
printf("Enter Jubayer's Age: ");
scanf("%d", &jubayer.age);
printf("Enter Jubayer's Salary: ");
scanf("%f", &jubayer.salary);
printf("Md Jakaria Nur\n");
printf("Age = %d Years\n", jakaria.age);
printf("Salary = %.2f USD\n", jakaria.salary);
printf("\nMd Jubayer Nur\n");
printf("Age = %d Years\n", jubayer.age);
printf("Salary = %.2f USD\n", jubayer.salary);
return 0 ; }
04. Two Person Age and Salary Structure
#include <stdio.h>
struct person {
int age;
float salary; };
int main() {
struct person jakaria = {22,3200.64};
struct person jubayer, mahdi;
jubayer.age = 24;
jubayer.salary = 65000.32;
mahdi = jubayer;
printf("Md Jakaria Nur\n");
printf("Age = %d Years\n", jakaria.age);
printf("Salary = %.2f USD\n", jakaria.salary);
printf("\nMd Jubayer Nur\n");
printf("Age = %d Years\n", jubayer.age);
printf("Salary = %.2f USD\n", jubayer.salary);
printf("\nTanvir Hasan Mahdi\n");
printf("Age = %d Years\n", mahdi.age);
printf("Salary = %.2f USD\n", mahdi.salary);
return 0 ; }
05. Taking Input – Two Person Age and Salary Structure
06. Taking Input – Two Person Age and Salary Structure
07. Taking Input – Two Person Age and Salary Structure
08. Taking Input – Two Person Age and Salary Structure
09. Taking Input – Two Person Age and Salary Structure
10. Taking Input – Two Person Age and Salary Structure
Thank You!
Leave a Reply