vectors representation

 #include <stdio.h>

typedef struct vector{

    int mag;

    char dir;

    

}vctr;

int main() {

    // Write C code here

    vctr x;

    vctr y;

    vctr z;

    printf("enter mag in x dir : ");

    scanf("%d",&x.mag);

    x.dir='x';

    printf("enter mag in y dir : ");

    scanf("%d",&y.mag);

    y.dir='y';

    printf("enter mag in z dir : ");

    scanf("%d",&z.mag);

     z.dir='z';

    printf("your vector is = %d%c + %d%c + %d%c",x.mag , x.dir , y.mag , y.dir,z.mag , z.dir);

    

    

    return 0;

}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings