Write the for and initial condition commands to calculate th

Write the for and initial condition commands to calculate the following sums or products. Print the sum or products only 600 + 800 + 1000 + 12000 + .. + 2000 2/3 + 3/3 + 4/3 + 5/5 + 6/3 + .. + 70/3 4/4 is not an error 1*2*3*4*5*6*7*8*9*10*55 55 is not an error Assume integers A and B (A

Solution

//Iteration of loop how much time you wnats the number

a Ans :
#!/bin/bash                                                                                                    
sum=0                                                                                                          
for (( i=600; i<=2000; i=i+200 ))                                                                              
do                                                                                                             
        sum=$(( sum + i ))                                                                                     
done                                                                                                           
        echo \"sum = $sum\"
      
b Ans :
#!/bin/bash                                                                                                    
sum=0                                                                                                          
for (( i=2; i<=70; i++))                                                                                       
do                                                                                                             
        sum=$(( sum + i ))                                                                                     
done                                                                                                           
        echo \"sum = ($sum)/3
      
c Ans :
#!/bin/bash                                                                                                    
product=1
for (( i=1; i<=10; i++))                                                                                       
do                                                                                                             
        product=$(( product * i ))                                                                                     
done                                                                                                           
        echo \"product = $(( product * 55 ))\"

a=1
a+(a+1)+(a+2)+(a+3)      

d Ans :

#!/bin/bash                                                                                                    
sum=0
A=1
B=10
for (( i=A; i<=B; i++))                                                                                       
do                                                                                                             
        sum=$(( sum + i ))                                                                                     
done                                                                                                           
        echo \"sum = $sum\"

 Write the for and initial condition commands to calculate the following sums or products. Print the sum or products only 600 + 800 + 1000 + 12000 + .. + 2000 2

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site