#include struct dna { int number; char text; char stringvalue[30]; }; int main() { struct dna dnavalue[5]; int i; for(i=0; i<4; i++) { printf("Sample %d\n",i+1); printf("Enter Number:\n"); scanf("%d", &dnavalue[i].number); printf("Enter Text :\n"); scanf("%c",&dnavalue[i].text); printf("Enter String :\n"); scanf("%s",dnavalue[i].stringvalue); } printf("Sample DNA Number Text String\n"); for(i=0; i<4; i++) { printf("%d\t\t", i+1); printf("%d\t\t", dnavalue[i].number); printf("%c\t\t", dnavalue[i].text); printf("%s", dnavalue[i].stringvalue); printf("\n"); } return 0; } Write comments on every line of this program explaining what's happening briefly
#include <stdio.h>
struct dna
{
int number;
char text;
char stringvalue[30];
};
int main()
{
struct dna dnavalue[5];
int i;
for(i=0; i<4; i++)
{
printf("Sample %d\n",i+1);
printf("Enter Number:\n");
scanf("%d", &dnavalue[i].number);
printf("Enter Text :\n");
scanf("%c",&dnavalue[i].text);
printf("Enter String :\n");
scanf("%s",dnavalue[i].stringvalue);
}
printf("Sample DNA Number Text String\n");
for(i=0; i<4; i++)
{
printf("%d\t\t", i+1);
printf("%d\t\t", dnavalue[i].number);
printf("%c\t\t", dnavalue[i].text);
printf("%s", dnavalue[i].stringvalue);
printf("\n");
}
return 0;
}
Write comments on every line of this program explaining what's happening briefly
Step by step
Solved in 2 steps