Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Labview, Construct a VI that could: - calculate the sum of a series of con

ID: 3935392 • Letter: U

Question

Using Labview, Construct a VI that could: - calculate the sum of a series of continuous integer numbers from 1 to given integer N. Sum=1+2+3+…+N (Tip: “While Loop” may be needed for calculation)
- calculate the sum of a series of continuous odd numbers from 1 to given odd number N. Sum=1+3+5+…+ N (Tip: “While Loop” may be needed for calculation)
-calculate the sum of a series of continuous even numbers from 1 to given odd number N. Sum=1+3+5+…+ N (Tip: “While Loop” may be needed for calculation)

Explanation / Answer

Answer:

1)

import java.util.*;
public class Sumnumbers
{
public static void main(String args[])
{
int input, i = 1 ;
int total = 0;
System.out.println("Enter the value of n :");
Scanner s = new Scanner(System.in);
input = s.nextInt();
while(i <= input)
{
total = total +i;
i++;
}
System.out.println("The sum of numbers is :"+total);
}
}

2)

import java.util.*;
public class Sumofodd
{   
public static void main ( String[] args )
{
int odd = 1;
int sumodd = 0;
  
System.out.println("Enter Number of items :");
Scanner s = new Scanner(System.in);
int input = s.nextInt();
while ( odd <= input )
{
sumodd = sumodd + odd;
odd = odd + 2;
}   
System.out.printf ( "Total sum of the odd number is"+sumodd);

  
}
}

3)

import java.util.*;
public class Sumofeven
{   
public static void main ( String[] args )
{
  
int even = 2;
int sumeven = 0;
System.out.println("Enter value of n :");
Scanner s = new Scanner(System.in);
int input = s.nextInt();

while (even <=input)
{
sumeven = sumeven + even;
even = even + 2;
}
System.out.printf ( "Sum of the even numbers is"+ sumeven);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote