Series of Integer using Structure coderinme

Series of Integer using Structure coderinme

Series of Integer using Structure coderinme
let us now define a structure to represent a vector (a series of integer values) and write a modular program to perform the following task:
a. To create vector
b. To modify the value of a given element
c. To multiply by a scalar value
d. To display the vector in the vector form
Add another function to the program that accepts two vectors as input parameters and return the addition of two vectors

#include <stdio.h>
struct vector
{
int value[20];
} vec;
int main()
{
int i,n,x;
printf("\nEnter the starting value: ");
scanf("%d",&x);
printf("Enter no. of value: ");
scanf("%d",&n);
for(i = 1; i <= n ; i++)
{
vec.value[i]=x*i;
printf("%d \t",vec.value[i]);
}
getch();
return 0;
}

For more programs in C, visit our C Coder Archives

Series of Integer using Structure coderinme

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.