This repository has been archived on 2026-07-28. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
college-work/Задания по C и C++/c/6.c
T

26 lines
725 B
C
Executable File

/*
6.Создать структуру, содержащую два поля – NAME и AGE. Задать две переменные типа этой структуры. Ввести их значения с клавиатуры и вывести на экран.
*/
#include <stdio.h>
struct person {
char NAME[32];
int AGE;
};
int main() {
struct person p1, p2;
printf("Enter name and age first person: ");
scanf("%s %d", p1.NAME, &p1.AGE);
printf("Enter name and age second person: ");
scanf("%s %d", p2.NAME, &p2.AGE);
printf("First person: %s, %2d age\n", p1.NAME, p1.AGE);
printf("Second person: %s, %2d age\n", p2.NAME, p2.AGE);
return 0;
}