Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- int main()
- {
- FILE *fp;
- fp = fopen("task3.txt", "r");
- int amount;
- fscanf(fp, "%d", &amount);
- for (int i = 0; i < amount; i++) {
- char subname[256];
- float height;
- float weight;
- fscanf(fp, "%s", subname);
- fscanf(fp, "%f", &height);
- fscanf(fp, "%f", &weight);
- printf("%d student:\n", i);
- printf("Subname: %s\n", subname);
- printf("Height: %f\n", height);
- printf("Weight: %f\n\n", weight);
- }
- fclose(fp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement