Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
REGISTRATION : 49746
#!/bin/sh
n=10
i=0
do
read a [$i]
r = a[$i] %2
m = $i%2
it [ $m –eq 0 ]
then
if [$r –ne 0 ]
then
break
fi
fi
done
ANSWER 02
#!/bin/bash
years_remaining=$(( 60-age ))
if [ "$years" -gt 1 ]
then
appraisal=$(( salary/10 ))
else
appraisal=0
fi
if [ "$designation" = "Higher-Management" ]
then
bonus=$(( 1000*hours ))
then
bonus=$(( 800*hours ))
then
bonus=$(( 500*hours ))
else
bonus=0
fi
ANSWER 03
Programming
Challenge
3.17 -
Monthly
Payments
//
//
// Rate * (1 + Rate)^N
// Payment = --------------------- * L
// ((1 + Rate)^N - 1)
//
// Rate is the monthly interest rate, which is the annual interest rate divided
// number of payments and L is the amount of the loan. Write a program that asks
//
//
// written by Walter Vaughan for CSC 134, section 200, Fall 2014
#include <iostream>
#include <iomanip>
#include <cmath>
int main() {
int numPayments;
// gather input
cout << "Enter the Monthly Interest Rate (as a decimal): ";
* loanAmt;
// like to pull that shit. If we round down the amount, we could end up
// paying too little to match the total interest amount, and if we don't
// round at all, our payments will not sum to the calculated interest rate.
ANSWER 04
Public class main
{
public static void main (string[] args ) {
Boolean res;
For(int i=1;i<=1000;i++){
If(isperfectnumber(i))
System.out.printin(i);
Int j=0,I;
Int sum=0;
For (i=1;i<=number/2;i++){
If(number%i==0){
Factor[j]=I;
J++:
Sum+=factors[k];
}
If(sum==number)
Return true;
Else
Return false;