Write a R program to compute sum, mean and product of a given vector elements

  • برمجة R

Write a R program to compute sum, mean and product of a given vector elements.

الأجوبة

nums = c(10, 20, 30)
print('Original vector:')
print(nums)   
print(paste("Sum of vector elements:",sum(nums)))
print(paste("Mean of vector elements:",mean(nums)))
print(paste("Product of vector elements:",prod(nums)))

Sample Output:

[1] "Original vector:"
[1] 10 20 30
[1] "Sum of vector elements: 60"
[1] "Mean of vector elements: 20"
[1] "Product of vector elements: 6000"
هل كان المحتوى مفيد؟

معلومات ذات صلة

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...