Question

In: Computer Science

I need these written in shell code 1.nested loop. e.g. 1*2 + 2*3 + 3*4 +...

I need these written in shell code

1.nested loop. e.g. 1*2 + 2*3 + 3*4 + ...(n-1)*n. (Only nested loops)

2.Fibonacci numbers.

Solutions

Expert Solution

The below shell code is directly written in bash shell (.sh)

1)

Shell code using nested loops :

Standard input and it's respective output :

2)

Shell code for Fibonacci series using nested loops :

  

Standard input and respective output :


Related Solutions

In the Main method add the code that counts by 1, 2, 3, 4, and 5 – see output below Use a nested for loop to implement the series of numbers C# Syntax:
code in C# How to count by n:   In the Main method add the code that counts by 1, 2, 3, 4, and 5 – see output below Use a nested for loop to implement the series of numbers C# Syntax:  The C# syntax for variable declarations, and if, if-else, while, and for statements is identical to Java   C# console output:  Console.Write("{0,2} ", number); // in this context number is an integer variable writes a number right-aligned in...
(This is for java) I need to rewrite this code that uses a while loop. public...
(This is for java) I need to rewrite this code that uses a while loop. public class Practice6 {      public static void main (String [] args) {         int sum = 2, i=2;        do { sum *= 6;    i++;    } while (i < 20); System.out.println("Total is: " + sum); }
1. Write a shell code that prints the integers from 80-90 2. Write a shell code...
1. Write a shell code that prints the integers from 80-90 2. Write a shell code that prints the sum of odd integers that are inputted by the user 3. Write a shell code that reads a set of integers {125, 0, 122, 129, 0, 117} and prints {125, 122, 129, 117} Programming Language: Linux
I DID STEP 1-2 AND 3 I JUST NEED A STEP 4 ANSWERS AND THIS IS...
I DID STEP 1-2 AND 3 I JUST NEED A STEP 4 ANSWERS AND THIS IS SO EMERGENCY(DUE DATE TONIGHT) PLEASE HELP (I WILL GIVE UPVOTE AND GOOD COMMENT THANK YOU) if you need to see step 1-2-3 I can add on the comment. Step 1 - WhoIs Step 2 - TCP Port Scanning Step 3 - UDP Port Scanning Step 4 - Analysis ---- Answer these questions: How can this type of scanning be used to help a network...
Write a code block to perform nested-for-loop sorting on a vector of State objects, arranging by...
Write a code block to perform nested-for-loop sorting on a vector of State objects, arranging by their string name attribute in alphabetical order A-Z. Assume all names are fully uppercase and that there's an assignment operator for the class. The name of the vector is "states".
I need code written in java for one of my projects the instructions are Write a...
I need code written in java for one of my projects the instructions are Write a program that interacts with the user via the console and lets them choose options from a food menu by using the associated item number. It is expected that your program builds an <orderString> representing the food order to be displayed at the end. (See Sample Run Below). Please note: Each student is required to develop their own custom menus, with unique food categories, items...
I need to develop a VHDL code for a FPGA basys 3, 4 digit 7 segment...
I need to develop a VHDL code for a FPGA basys 3, 4 digit 7 segment display. So when binary 0, 1 ,and 2 are inputted the display says bad. When binary 3,4,5,6, the display says good.
I need to develop a VHDL code for a FPGA basys 3, 4 digit 7 segment...
I need to develop a VHDL code for a FPGA basys 3, 4 digit 7 segment display. So when binary 0, 1 ,and 2 are inputted the display says bad. When binary 3,4,5,6, the display says good.
I need 3 & 4... free free to answer 1 & 2 if you want! Lenses...
I need 3 & 4... free free to answer 1 & 2 if you want! Lenses may be simple ones with two spherical curved surfaces on a piece of transparent material like glass or plastic, or much more complex and compounded of different elements each with sometimes a different material. The surfaces do not have to be spherical, and manufacturing techniques today allow combining these "aspheric" lenses in designs that produce exquisite detail in an image. Your cell phone camera...
Where is the infinite loop in the code? Input for the code 1 2.5 2 40200000...
Where is the infinite loop in the code? Input for the code 1 2.5 2 40200000 1 0 2 80400000 2 ffffffff 3 #include <stdio.h> #include <math.h> #include <stdlib.h> int count = 31; void toBinary(int num, int n){ for(int i = 1; i < n; i++){ if((int)(num/pow(2,(n-i))) > 0){ num = num - pow(2,(n-i)); printf("1"); count--; }else{ printf("0"); count--; } } } char checkSign (int sign) { char new_sign; if (sign == 0) { new_sign = '+'; return new_sign; }...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT