array of vectors using display fn
#include<stdio.h>
typedef struct complex{
int x;
int y;
int z;
}cmplx;
cmplx display(cmplx v1[5] ){
for (int i = 0; i<5 ; i++){
printf("enter mag of x of complex no %d : ", i+1);
scanf("%d",&v1[i].x);
printf("enter mag of y of complex no %d : ", i+1);
scanf("%d",&v1[i].y);
printf("enter mag of z of complex no %d : ", i+1);
scanf("%d",&v1[i].z);
}
for (int i = 0; i<5 ; i++){
printf("the complex no %d is : %di + %dj + %dk\n", i+1 , v1[i].x,v1[i].y,v1[i].z);
}
}
int main() {
cmplx v1[5];
display(v1);
return 0;
}
Comments
Post a Comment