Answer:
// C program to find sum and average of 10 elements.
#include <stdio.h>
// main function
int main(void) {
// array
double arr[10];
// variables
double average,sum=0;
int i;
// ask to enter 10 elements of the array
printf("Enter 10 elements of the array:");
for(i=0;i<10;i++)
{
// read elements of the array
scanf("%lf", &arr[i]);
// calculate the sum of elements
sum=sum+arr[i];
}
// fint the average
average=sum/10;
// print sum
printf("Sum of 10 elements of the array is:%f ",sum);
// print average
printf("\nAverage of 10 elements of the array is:%f ",average);
return 0;
}
Explanation:
Create an array of size 10.Then read 10 values from user and store them into array.Find the sum of 10 elements of the array and assign it to variable "sum". Find the average by dividing sum with 10.Print the sum and average.
Output:
Enter 10 elements of the array:3 2 4 5 1 4 8 9 12 10
Sum of 10 elements of the array is:58.000000
Average of 10 elements of the array is:5.800000
Answer:
The function in Python is as follows:
def rotateRight(strng, d):
lent = len(strng)
retString = strng[lent - d : ] + strng[0 : lent - d]
return retString
Explanation:
This defines the function
def rotateRight(strng, d):
This calculates the length of the string
lent = len(strng)
This calculates the return string
retString = strng[lent - d : ] + strng[0 : lent - d]
This returns the return string
return retString
Addition:
The return string is calculated as thus:
This string is split from the <em>index passed to the function to the last element of the string, i.e. from dth to last.</em>
<em>The split string is then concatenated to the beginning of the remaining string</em>
Answer:
RUP
Explanation:
RUP or Rational Unified Process is an IBM's software that divides the development process in four phases. It was developed to work throughout the entire software development life cycle, it's adaptive.
I hope you find this information useful and interesting! Good luck!
Answer:
courseStudent.setName("Smith");
courseStudent.setAge(20);
courseStudent.setID(9999);
courseStudent.printAll();
System.out.print(", Id: " + courseStudent.getID());
Explanation:
This is the part of the code that needs to be added in order to print the output same as mentioned in the question. These lines should be added in the main method where solution is asked.