Program 2
INTRODUCTION TO VECTORS IN R.
In R programming, a vector is the most basic and important data structure used to
store multiple values in a single variable. All elements in a vector must be of the
same data type, such as numeric, character, or logical. Vectors are used to perform
various mathematical, statistical, and logical operations efficiently. They can be
created using the c() function and support operations like addition, subtraction,
sorting, filtering, and finding maximum or minimum values. Vectors play a
fundamental role in data manipulation and analysis in R, making them essential for
statistical computing and programming
[Link] a progam to check wether a given number is +ve even number
or -ve even number?
Ans Code: Output:
[Link] a program to take name and age as an input and check wether
he/she is eligible for vote or not?
Ans Code: Output:
Q3 Write a program to perform various arithmetic and logical operator
on vector?
Ans Code: Output:
Q4 Write a program to take input a year and check whether it is leap
year or not?
Ans Code: Output:
Q5 Write a program to perform numerical operations such as max ,min
average,square root,round off ,sum on a vector of 7?
Ans Code: Output:
Q6 Write a program to arrange all the values in ascending or descending
order?
Ans Code: Output:
Q7Write a program to count a value in a range from a particular vector ?
Ans Code: Output:
Q8 Write a Program to find a common element among three different
vector?
Ans Code: Output:
Q9 Write a program to find all distinct elements from a given vector?
Ans Code: Output:
Q10 Write a program to test if a particular value is a part of vector or not?
Ans Code: Output: