#Experiment-1 except 1 and 15 as they need input from user

#2
objects <- ls()
for (object in objects) {
  cat("Object Name:", object, "\n")
  cat("Class:", class(get(object)), "\n")
  cat("Structure:\n")
  print(str(get(object)))
  cat("\n")
}

#3
sequence <- 20:50
mean_20_to_60 <- mean(20:60)
sum_51_to_91 <- sum(51:91)
cat("Sequence: ", sequence)
## Sequence:  20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
cat("\nMean: ", mean_20_to_60)
## 
## Mean:  40
cat("\nSum: ", sum_51_to_91)
## 
## Sum:  2911
#4
random_vector <- sample(-50:50, 10, replace = TRUE)
cat("Random values: ", random_vector)
## Random values:  27 7 -13 26 36 37 28 39 -5 39
#5
fib <- numeric(10)
fib[1] <- 0
fib[2] <- 1
for (i in 3:10) {
  fib[i] <- fib[i - 1] + fib[i - 2]
}
cat("Fibinoacci series: ", fib)
## Fibinoacci series:  0 1 1 2 3 5 8 13 21 34
#6
letters_lower <- letters[1:10]
letters_upper_last <- toupper(letters[17:26])
letters_upper_22_to_24 <- toupper(letters[22:24])
cat("Lowercase letters in the start: ", letters_lower)
## Lowercase letters in the start:  a b c d e f g h i j
cat("\nUppercase letters in the end: ", letters_upper_last)
## 
## Uppercase letters in the end:  Q R S T U V W X Y Z
cat("\nUppercase letters in between: ", letters_upper_22_to_24)
## 
## Uppercase letters in between:  V W X
#7
vector <- c(2, 1, 0, 6, 5)#Random vector taken
max_value <- max(vector)
min_value <- min(vector)
cat("Max value: ", max_value)
## Max value:  6
cat("\nMin value: ", min_value)
## 
## Min value:  0
#8
unique_string <- unique(strsplit("Visualisation", NULL)[[1]])
unique_vector <- unique(c(1, 2, 2, 3, 3, 3))
cat("Unique characters in string: ", unique_string)
## Unique characters in string:  V i s u a l t o n
cat("\nUnique numbers in the vector: ", unique_vector)
## 
## Unique numbers in the vector:  1 2 3
#9
a <- c(1, 2, 3)
b <- c(4, 5, 6)
c <- c(7, 8, 9)
result <- matrix(c(a, b, c), nrow=3, byrow=FALSE)
cat("Combined Matrix: ", result)
## Combined Matrix:  1 2 3 4 5 6 7 8 9
#10
random_list <- rnorm(65)
occurrences <- table(random_list) 
cat("List: ", random_list)
## List:  -0.3263863 -2.04803 0.9137257 -0.2555159 0.9363121 0.0392561 -0.3196928 0.09440307 2.285322 -0.6585349 -1.004089 1.210694 -1.652925 -1.100675 -0.8160821 -0.9544835 -0.5852272 -1.887455 0.170629 0.3950414 0.2979762 0.4639108 0.4605013 0.02128202 -0.0409731 -2.34163 -1.522685 0.76013 -0.5791727 0.739704 0.5847004 -2.094869 0.5120813 1.74189 1.111894 -0.5026745 0.6394856 0.2984305 -2.523878 -0.4560295 0.2938852 2.093212 -0.9852411 -0.4066922 -1.101112 0.3074798 0.2986948 -1.800739 -0.7178571 2.208895 1.692517 -1.97711 -1.637764 1.688493 -0.7705347 -0.4411474 1.384195 0.1599661 0.5959678 0.3722479 0.7349761 1.128492 0.7725992 -0.0556442 -1.661389
cat("\nOccurrences: ", occurrences)
## 
## Occurrences:  1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#we can also use round here which might give a better expected result
random_list <- round(rnorm(65))
occurrences <- table(random_list) 
cat("List: ", random_list)
## List:  2 0 -2 -2 -2 1 0 1 1 1 0 0 1 0 0 1 0 0 -1 0 -2 0 0 0 1 2 -2 0 -1 0 -1 1 -2 0 1 -1 0 -1 -2 0 -1 1 0 0 -1 -1 1 1 0 -1 1 0 1 -1 0 0 1 -1 0 1 1 0 2 0 -1
cat("\nOccurrences: ", occurrences)
## 
## Occurrences:  7 12 26 17 3
#11
data <- read.csv("C:/Users/bmpav/OneDrive/Desktop/revenuefinal.csv")
print(data)
##     SerialNumber                                     Names  Rank Marketcap
## 1              1                              Shree Cement #1344  $12.13 B
## 2              2                 Shriram Transport Finance #1513  $10.42 B
## 3              3  National Mineral Development Corporation #1914   $7.65 B
## 4              4                                       ACC #2394   $5.59 B
## 5              5                             Siemens India  #985  $18.02 B
## 6              6                           Rain Industries #5410   $0.71 B
## 7              7                             ICICI Lombard #1721   $8.78 B
## 8              8                   Reliance Infrastructure #4963   $1.02 B
## 9              9                           IDFC FIRST Bank #2098   $6.80 B
## 10            10                       Chambal Fertilisers #4144   $1.84 B
## 11            11                         Adani Ports & SEZ  #609  $29.80 B
## 12            12                     Madras Rubber Factory #2053   $6.98 B
## 13            13                              Apollo Tyres #2938   $3.95 B
## 14            14                                     Cipla #1257  $13.30 B
## 15            15                    Indian Railway Finance  #670  $27.35 B
## 16            16                             Torrent Power #2334   $5.78 B
## 17            17                               Dr. Reddy's #1383  $11.72 B
## 18            18                          Aurobindo Pharma #1829   $8.11 B
## 19            19                      National Fertilizers #5361   $0.74 B
## 20            20                     Hindustan Aeronautics  #787  $23.36 B
## 21            21                              Indus Towers #1995   $7.30 B
## 22            22                             IndusInd Bank #1191  $14.15 B
## 23            23                            Hindustan Zinc #1080  $15.93 B
## 24            24                        Power Finance Corp #1048  $16.64 B
## 25            25                                 Oil India #2486   $5.25 B
## 26            26                             Bank of India #2016   $7.20 B
## 27            27                             Bajaj Finance  #339  $52.66 B
## 28            28                      Aditya Birla Capital #2504   $5.18 B
## 29            29                               Indian Bank #1954   $7.46 B
## 30            30                           Patanjali Foods #2076   $6.88 B
## 31            31                            Ambuja Cements #1247  $13.39 B
## 32            32                                 TVS Motor #1444  $11.10 B
## 33            33                             Hero MotoCorp #1490  $10.68 B
## 34            34                               LTIMindtree  #924  $19.58 B
## 35            35                              Asian Paints  #542  $34.03 B
## 36            36                    Max Financial Services #3062   $3.64 B
## 37            37                                Bajaj Auto  #716  $25.88 B
## 38            38                               Adani Power  #733  $25.21 B
## 39            39                       New India Assurance #2695   $4.58 B
## 40            40                             Vodafone Idea #1756   $8.55 B
## 41            41            Powergrid Corporation of India  #669  $27.47 B
## 42            42                             Titan Company  #453  $40.27 B
## 43            43                             Ashok Leyland #2289   $5.99 B
## 44            44                        Sun Pharmaceutical  #464  $39.50 B
## 45            45    General Insurance Corporation of India #1960   $7.44 B
## 46            46                          Jindal Stainless #2470   $5.33 B
## 47            47                                     DMart  #623  $29.24 B
## 48            48                                       UPL #2600   $4.85 B
## 49            49                      Punjab National Bank #1210  $13.86 B
## 50            50                             Tech Mahindra #1102  $15.52 B
## 51            51                       Union Bank of India #1313  $12.51 B
## 52            52                              Adani Wilmar #2430   $5.49 B
## 53            53                                Tata Power #1198  $14.03 B
## 54            54                              Petronet LNG #2647   $4.69 B
## 55            55                       InterGlobe Aviation #1258  $13.29 B
## 56            56                        Hindustan Unilever  #239  $68.70 B
## 57            57                               Canara Bank #1547  $10.15 B
## 58            58                       Kotak Mahindra Bank  #434  $42.29 B
## 59            59                         Chennai Petroleum #4527   $1.43 B
## 60            60                          UltraTech Cement  #534  $34.57 B
## 61            61                                       ITC  #241  $68.42 B
## 62            62                            Bank of Baroda #1193  $14.13 B
## 63            63                                 Axis Bank  #479  $38.71 B
## 64            64                      Jindal Steel & Power #1720   $8.79 B
## 65            65                             ICICI Prulife #1779   $8.43 B
## 66            66                           Redington India #4323   $1.62 B
## 67            67                     Samvardhana Motherson #1640   $9.40 B
## 68            68                                 HDFC Life #1135  $14.98 B
## 69            69                                     Wipro  #605  $29.84 B
## 70            70                             Bajaj Finserv  #576  $31.23 B
## 71            71                          HCL Technologies  #350  $50.51 B
## 72            72                         Adani Enterprises  #461  $39.70 B
## 73            73                  Steel Authority of India #2305   $5.91 B
## 74            74                        SBI Life Insurance #1050  $16.63 B
## 75            75   Housing Development Finance Corporation  #285  $60.86 B
## 76            76                         Grasim Industries #1057  $16.46 B
## 77            77                       Maruti Suzuki India  #501  $37.38 B
## 78            78                       Mahindra & Mahindra  #756  $24.47 B
## 79            79                                Coal India  #635  $28.87 B
## 80            80                                      GAIL #1271  $13.08 B
## 81            81                                   Vedanta #1375  $11.78 B
## 82            82                             Bharti Airtel  #182  $82.09 B
## 83            83                                   Infosys  #179  $83.69 B
## 84            84                                ICICI Bank  #177  $85.20 B
## 85            85                                 HDFC Bank   #90 $143.30 B
## 86            86                                 JSW Steel  #769  $24.02 B
## 87            87                              NTPC Limited  #509  $36.73 B
## 88            88                           Larsen & Toubro  #299  $59.43 B
## 89            89                       Hindalco Industries #1120  $15.26 B
## 90            90                                Tata Steel  #906  $19.93 B
## 91            91                 Tata Consultancy Services   #74 $165.88 B
## 92            92                       State Bank of India  #258  $65.80 B
## 93            93                            Rajesh Exports #4702   $1.24 B
## 94            94                               Tata Motors  #519  $35.71 B
## 95            95                       Hindustan Petroleum #1986   $7.35 B
## 96            96                          Bharat Petroleum #1327  $12.34 B
## 97            97                         Oil & Natural Gas  #525  $35.43 B
## 98            98                                Indian Oil  #778  $23.81 B
## 99            99 Life Insurance Corporation of India (LIC)  #237  $68.75 B
## 100          100                       Reliance Industries   #48 $220.32 B
##     Share.Price                 Categories   Revenue Country
## 1       $336.31                              $2.28 B   India
## 2        $27.76       ๐Ÿ’ณ Financial services   $2.29 B   India
## 3         $2.61                   โ›๏ธ Mining   $2.30 B   India
## 4        $29.69                     Cement   $2.30 B   India
## 5        $50.60                              $2.33 B   India
## 6         $2.11                ๐Ÿงช Chemicals   $2.35 B   India
## 7        $17.84                ๐Ÿฆ Insurance   $2.38 B   India
## 8         $2.59              ๐Ÿ”‹ Electricity   $2.50 B   India
## 9         $0.96                    ๐Ÿฆ Banks   $2.54 B   India
## 10        $4.44                ๐Ÿงช Chemicals   $2.77 B   India
## 11       $13.79                   โš“ Ports   $2.81 B   India
## 12       $1,647                      Tires   $2.90 B   India
## 13        $6.23                      Tires   $2.99 B   India
## 14       $16.48          ๐Ÿ’Š Pharmaceuticals   $3.02 B   India
## 15        $2.09                 ๐Ÿš‚ Railways   $3.13 B   India
## 16       $12.04              ๐Ÿ”‹ Electricity   $3.20 B   India
## 17       $69.54          ๐Ÿ’Š Pharmaceuticals   $3.23 B   India
## 18       $13.85          ๐Ÿ’Š Pharmaceuticals   $3.23 B   India
## 19        $1.51     ๐ŸŒฑ Fertilizer companies   $3.28 B   India
## 20       $34.94   โœˆ๏ธ Aircraft manufacturers   $3.36 B   India
## 21        $2.71        ๐Ÿ“ก Telecommunication   $3.40 B   India
## 22       $18.19                    ๐Ÿฆ Banks   $3.50 B   India
## 23        $3.77                              $3.52 B   India
## 24        $5.04       ๐Ÿ’ณ Financial services   $3.59 B   India
## 25        $4.85                  ๐Ÿ›ข Oil&Gas   $3.63 B   India
## 26        $1.58                    ๐Ÿฆ Banks   $3.63 B   India
## 27       $85.26       ๐Ÿ’ณ Financial services   $3.70 B   India
## 28        $1.99                ๐Ÿฆ Insurance   $3.71 B   India
## 29        $5.54                    ๐Ÿฆ Banks   $3.76 B   India
## 30       $19.03                     ๐Ÿด Food   $3.77 B   India
## 31        $6.74                     Cement   $3.85 B   India
## 32       $23.36 ๐Ÿ Motorcycle Manufacturers   $3.93 B   India
## 33       $53.45 ๐Ÿ Motorcycle Manufacturers   $4.18 B   India
## 34       $66.12    ๐Ÿ’ผ Professional services   $4.27 B   India
## 35       $35.49          ๐ŸŽจ Paint & Coating   $4.29 B   India
## 36       $10.57                ๐Ÿฆ Insurance   $4.62 B   India
## 37       $91.42                              $4.98 B   India
## 38        $6.54              ๐Ÿ”‹ Electricity   $5.09 B   India
## 39        $2.78                ๐Ÿฆ Insurance   $5.11 B   India
## 40        $0.18        ๐Ÿ“ก Telecommunication   $5.14 B   India
## 41        $2.95              ๐Ÿ”‹ Electricity   $5.37 B   India
## 42       $45.37            โŒš Luxury goods   $5.39 B   India
## 43        $2.04            ๐Ÿญ Manufacturing   $5.39 B   India
## 44       $16.46          ๐Ÿ’Š Pharmaceuticals   $5.52 B   India
## 45        $4.24                ๐Ÿฆ Insurance   $5.57 B   India
## 46        $6.48           ๐Ÿšš Transportation   $5.72 B   India
## 47       $44.93                   ๐Ÿ›๏ธ Retail   $5.87 B   India
## 48        $6.47                ๐Ÿงช Chemicals   $5.93 B   India
## 49        $1.26                    ๐Ÿฆ Banks   $6.35 B   India
## 50       $15.91                              $6.39 B   India
## 51        $1.69                    ๐Ÿฆ Banks   $6.55 B   India
## 52        $4.22                     ๐Ÿด Food   $6.59 B   India
## 53        $4.39              ๐Ÿ”‹ Electricity   $6.84 B   India
## 54        $3.09                  ๐Ÿ›ข Oil&Gas   $7.06 B   India
## 55       $34.45                 โœˆ๏ธ Airlines   $7.36 B   India
## 56       $29.22                     ๐Ÿด Food   $7.45 B   India
## 57        $5.60                    ๐Ÿฆ Banks   $7.56 B   India
## 58       $21.28                    ๐Ÿฆ Banks   $8.00 B   India
## 59        $9.63                  ๐Ÿ›ข Oil&Gas   $8.05 B   India
## 60      $119.96                     Cement   $8.26 B   India
## 61        $5.48                  ๐Ÿšฌ Tobacco   $8.44 B   India
## 62        $2.73                    ๐Ÿฆ Banks   $8.53 B   India
## 63       $12.55                    ๐Ÿฆ Banks   $8.83 B   India
## 64        $8.62          ๐Ÿ”ฉ Steel producers   $8.91 B   India
## 65        $5.85                ๐Ÿฆ Insurance   $9.44 B   India
## 66        $2.08                             $10.53 B   India
## 67        $1.39     ๐Ÿš˜ Automotive Suppliers  $10.64 B   India
## 68        $6.97                ๐Ÿฆ Insurance  $11.00 B   India
## 69        $5.72    ๐Ÿ’ผ Professional services  $11.12 B   India
## 70       $19.62       ๐Ÿ’ณ Financial services  $11.26 B   India
## 71       $18.65    ๐Ÿ’ผ Professional services  $12.76 B   India
## 72       $34.82             ๐Ÿ™ Conglomerate  $12.82 B   India
## 73        $1.43          ๐Ÿ”ฉ Steel producers  $13.12 B   India
## 74       $16.62                ๐Ÿฆ Insurance  $14.15 B   India
## 75       $32.87                    ๐Ÿฆ Banks  $14.22 B   India
## 76       $24.99                             $14.87 B   India
## 77      $118.90               ๐Ÿš— Automakers  $15.31 B   India
## 78       $19.68               ๐Ÿš— Automakers  $15.69 B   India
## 79        $4.69                   โ›๏ธ Mining  $15.84 B   India
## 80        $1.99                  ๐Ÿ›ข Oil&Gas  $17.05 B   India
## 81        $3.17                   โ›๏ธ Mining  $17.43 B   India
## 82       $13.97        ๐Ÿ“ก Telecommunication  $17.73 B   India
## 83       $20.22    ๐Ÿ’ผ Professional services  $18.55 B   India
## 84       $24.13                    ๐Ÿฆ Banks  $18.63 B   India
## 85       $56.61                    ๐Ÿฆ Banks  $20.39 B   India
## 86        $9.82          ๐Ÿ”ฉ Steel producers  $20.97 B   India
## 87        $3.79              ๐Ÿ”‹ Electricity  $21.44 B   India
## 88       $43.24             ๐Ÿ— Construction  $24.48 B   India
## 89        $6.83                             $26.05 B   India
## 90        $1.61          ๐Ÿ”ฉ Steel producers  $28.19 B   India
## 91       $45.85    ๐Ÿ’ผ Professional services  $28.90 B   India
## 92        $7.37                    ๐Ÿฆ Banks  $36.81 B   India
## 93        $4.23                   ๐Ÿ›๏ธ Retail  $39.91 B   India
## 94        $9.77               ๐Ÿš— Automakers  $43.65 B   India
## 95        $5.18                  ๐Ÿ›ข Oil&Gas  $51.52 B   India
## 96        $5.71                  ๐Ÿ›ข Oil&Gas  $54.11 B   India
## 97        $2.82                  ๐Ÿ›ข Oil&Gas  $78.08 B   India
## 98        $1.73                  ๐Ÿ›ข Oil&Gas  $94.87 B   India
## 99       $10.87                ๐Ÿฆ Insurance  $97.94 B   India
## 100      $32.56             ๐Ÿ™ Conglomerate $106.19 B   India
#12
employee_data <- data.frame(
  Name = c("John", "Alice", "Bob", "Emily", "David", "Smith", "Cumminis", "Head", "Lyon", "Strac"),
  Age = c(30, 25, 35, 28, 32, 45, 24, 35, 86, 21),
  Salary = c(50000, 60000, 70000, 55000, 75000, 100000, 18000, 29000, 34000, 150000)
)
print(employee_data)
##        Name Age Salary
## 1      John  30  50000
## 2     Alice  25  60000
## 3       Bob  35  70000
## 4     Emily  28  55000
## 5     David  32  75000
## 6     Smith  45 100000
## 7  Cumminis  24  18000
## 8      Head  35  29000
## 9      Lyon  86  34000
## 10    Strac  21 150000
cat("\n\nSummary of data: \n", summary(employee_data))
## 
## 
## Summary of data: 
##  Length:10          Class :character   Mode  :character   NA NA NA Min.   :21.00   1st Qu.:25.75   Median :31.00   Mean   :36.10   3rd Qu.:35.00   Max.   :86.00   Min.   : 18000   1st Qu.: 38000   Median : 57500   Mean   : 64100   3rd Qu.: 73750   Max.   :150000
#13
for (i in 1:100) {
  if(i%%(4*2)==0)#multiple for both 2 and 4 
  {
    print("DATA VISUALIZATION")
  }else if(i%%4==0)#multiple of 2
  {
    print("VISUALIZATION")
  }else if(i%%2==0)#multiple of 4
  {
    print("DATA")
  }else {
    print(i)
  }
}
## [1] 1
## [1] "DATA"
## [1] 3
## [1] "VISUALIZATION"
## [1] 5
## [1] "DATA"
## [1] 7
## [1] "DATA VISUALIZATION"
## [1] 9
## [1] "DATA"
## [1] 11
## [1] "VISUALIZATION"
## [1] 13
## [1] "DATA"
## [1] 15
## [1] "DATA VISUALIZATION"
## [1] 17
## [1] "DATA"
## [1] 19
## [1] "VISUALIZATION"
## [1] 21
## [1] "DATA"
## [1] 23
## [1] "DATA VISUALIZATION"
## [1] 25
## [1] "DATA"
## [1] 27
## [1] "VISUALIZATION"
## [1] 29
## [1] "DATA"
## [1] 31
## [1] "DATA VISUALIZATION"
## [1] 33
## [1] "DATA"
## [1] 35
## [1] "VISUALIZATION"
## [1] 37
## [1] "DATA"
## [1] 39
## [1] "DATA VISUALIZATION"
## [1] 41
## [1] "DATA"
## [1] 43
## [1] "VISUALIZATION"
## [1] 45
## [1] "DATA"
## [1] 47
## [1] "DATA VISUALIZATION"
## [1] 49
## [1] "DATA"
## [1] 51
## [1] "VISUALIZATION"
## [1] 53
## [1] "DATA"
## [1] 55
## [1] "DATA VISUALIZATION"
## [1] 57
## [1] "DATA"
## [1] 59
## [1] "VISUALIZATION"
## [1] 61
## [1] "DATA"
## [1] 63
## [1] "DATA VISUALIZATION"
## [1] 65
## [1] "DATA"
## [1] 67
## [1] "VISUALIZATION"
## [1] 69
## [1] "DATA"
## [1] 71
## [1] "DATA VISUALIZATION"
## [1] 73
## [1] "DATA"
## [1] 75
## [1] "VISUALIZATION"
## [1] 77
## [1] "DATA"
## [1] 79
## [1] "DATA VISUALIZATION"
## [1] 81
## [1] "DATA"
## [1] 83
## [1] "VISUALIZATION"
## [1] 85
## [1] "DATA"
## [1] 87
## [1] "DATA VISUALIZATION"
## [1] 89
## [1] "DATA"
## [1] 91
## [1] "VISUALIZATION"
## [1] 93
## [1] "DATA"
## [1] 95
## [1] "DATA VISUALIZATION"
## [1] 97
## [1] "DATA"
## [1] 99
## [1] "VISUALIZATION"
#14
factor_vector <- factor(levels = c())
values <- c(1, 2, 3, 4, 5, 6, 7)
factor_vector <- append(factor_vector, values)
numeric_vector <- as.numeric(factor_vector)
vector_sum <- sum(numeric_vector)
vector_mean <- mean(numeric_vector)
cat("Vector Elements:", factor_vector, "\n")
## Vector Elements: 1 2 3 4 5 6 7
n <- 2
nth_elements <- factor_vector[seq(from = 1, to = length(factor_vector), by = n)]
cat("Sum of the vector:", vector_sum, "\n")
## Sum of the vector: 28
cat("Mean of the vector:", vector_mean, "\n")
## Mean of the vector: 4
cat("Every", n, "th element of the vector:", nth_elements, "\n")
## Every 2 th element of the vector: 1 3 5 7
#16
i <- 1
while (i^2 <= 4000) {
  i <- i + 1
}
cat("First positive integer whose square to exceed 4000: ", i)
## First positive integer whose square to exceed 4000:  64
#17
numeric_vector <- c(1.3, 6.5, 0.9, 4.4, 3.4, 1.5)
complex_vector <- c(1 + 20i, 3 + 11i, 5 + 6i, 3 + 9i, 2 + 60i, 9 + 13i)
logical_vector <- c(TRUE, FALSE, TRUE, FALSE, TRUE, FALSE)
character_vector <- c("pavan", "vamshi", "sandeep", "harsha", "darshita", "rupa")
print(paste("Numeric Vector:", numeric_vector))
## [1] "Numeric Vector: 1.3" "Numeric Vector: 6.5" "Numeric Vector: 0.9"
## [4] "Numeric Vector: 4.4" "Numeric Vector: 3.4" "Numeric Vector: 1.5"
print(paste("Complex Vector:", complex_vector))
## [1] "Complex Vector: 1+20i" "Complex Vector: 3+11i" "Complex Vector: 5+6i" 
## [4] "Complex Vector: 3+9i"  "Complex Vector: 2+60i" "Complex Vector: 9+13i"
print(paste("Logical Vector:", logical_vector))
## [1] "Logical Vector: TRUE"  "Logical Vector: FALSE" "Logical Vector: TRUE" 
## [4] "Logical Vector: FALSE" "Logical Vector: TRUE"  "Logical Vector: FALSE"
print(paste("Character Vector:", character_vector))
## [1] "Character Vector: pavan"    "Character Vector: vamshi"  
## [3] "Character Vector: sandeep"  "Character Vector: harsha"  
## [5] "Character Vector: darshita" "Character Vector: rupa"
#18
a <- c(1, 2, 3)
b <- c(4, 5, 6)
c <- c(7, 8, 9)
result <- matrix(c(a, b, c), nrow=3, byrow=FALSE)
cat("Combined Matrix: ", result)
## Combined Matrix:  1 2 3 4 5 6 7 8 9
#19
matrix <- matrix(c(4.3, 3.1, 8.2, 8.2, 3.2, 0.9, 1.6, 6.5), nrow = 4, byrow = TRUE)
print("Matrix:")
## [1] "Matrix:"
print(matrix)
##      [,1] [,2]
## [1,]  4.3  3.1
## [2,]  8.2  8.2
## [3,]  3.2  0.9
## [4,]  1.6  6.5
#20
numeric_vector <- c(1, 2, 3, 4, 5, 6)
character_vector <- c("a", "b", "c", "d", "e", "f")
logical_vector <- c(TRUE, FALSE, TRUE, FALSE, TRUE, FALSE)
cat("Vector_1", numeric_vector, "\n")
## Vector_1 1 2 3 4 5 6
cat("Type:", typeof(numeric_vector), "\n\n")
## Type: double
cat("Vector_2:", character_vector, "\n")
## Vector_2: a b c d e f
cat ("Type:", typeof (character_vector), "\n\n")
## Type: character
cat("Vector_3:", logical_vector, "\n")
## Vector_3: TRUE FALSE TRUE FALSE TRUE FALSE
cat("Type:", typeof(logical_vector), "\n")
## Type: logical