Enable contrast version

# Tutor profile: Nithin N.

Inactive
Nithin N.
Tutoring students of my locality for the past 6 years
Tutor Satisfaction Guarantee

## Questions

### Subject:Java Programming

TutorMe
Question:

Write a program to compute the sum, average, maximum and minimum of elements in an array.

Inactive
Nithin N.

package example; import java.util.Scanner; public class JavaProgram { public static void main(String[] args) { int n; int ch=0; float avg = 0; Scanner s = new Scanner(System.in); System.out.println("Enter your option:\n1. Sum of elements of the array"); System.out.println("2. Average of array\n3. Maximum\n4. Minimum\n5. Exit"); ch = s.nextInt(); System.out.print("Enter no. of elements you want in array:"); n = s.nextInt(); int a[] = new int[n]; System.out.println("Enter all the elements:"); for(int i = 0; i < n ; i++) a[i]=s.nextInt(); if(ch==1) { int total=0; for(int i=0; i<a.length;i++) total=total+a[i]; System.out.println("Sum of elements of the array = "+total); } else if(ch==2) { int total=0; for(int i=0; i<a.length;i++) total=total+a[i]; total=total/a.length; System.out.println("Average of elements of the array = "+total); } else if(ch==3) { int max = a[0]; for (int i = 0; i < a.length; i++) { if (a[i] > max) { max = a[i]; } } System.out.println("Maximum of elements of the array = "+max); } else if(ch==4) { int min = a[0]; for (int i = 0; i < a.length; i++) { if (a[i] < min) { min = a[i]; } } System.out.println("Minimum of elements of the array = "+min); } } }

### Subject:Basic Math

TutorMe
Question:

Out of 7 consonants and 4 vowels, how many words of 3 consonants and 2 vowels can be formed?

Inactive
Nithin N.

Number of ways of selecting 3 consonants from 7 = 7C3 Number of ways of selecting 2 vowels from 4 = 4C2 Number of ways of selecting 3 consonants from 7 and 2 vowels from 4 = 7C3 × 4C2 =(7×6×5/3×2×1)×(4×3/2×1)=210 It means we can have 210 groups where each group contains total 5 letters (3 consonants and 2 vowels). Number of ways of arranging 5 letters among themselves =5!=5×4×3×2×1=120 Hence, required number of ways =210×120 =25200

### Subject:C++ Programming

TutorMe
Question:

Write a program to compute the standard deviation and Average of n numbers read from a file whose name is input in the program.

Inactive
Nithin N.

#include <iostream> #include <fstream> #include <string> #include <cmath> using namespace std; int main() { ifstream input; double number, sum = 0.0; double average, standardDeviation = 0.0; double *arr; int count = 0, i = 0; int flag=0; string file_name; while(flag!=3) { cout << "Enter the file name: "; cin >> file_name; //Open the input file input.open(file_name.c_str()); if (!input) { cout << "File not found!!!" << endl; flag++; } else { while (input >> number) { count++; } input.close(); arr = new double[count]; input.open(file_name.c_str()); while (input >> number) { sum += number; arr[i] = number; i++; } average = sum / count; for (int j = 0; j < count; ++j) { standardDeviation += pow((arr[j]-average), 2); } standardDeviation = sqrt(standardDeviation / count); cout << "The average is: " << average << endl; cout << "The standard deviation is: " << standardDeviation << endl; input.close(); return 0; } } }

## Contact tutor

Send a message explaining your
needs and Nithin will reply soon.
Contact Nithin