Body.
head contains all of the data that we generally don't see.
Link is used to link to external stylesheets.
script is where you would type scrips.
doctype is used to tell the browser the document type.
It is B.series of links to other stories.
Answer:
The function in Python is as follows:
def digitSum( n ):
if n == 0:
return 0
if n>0:
return (n % 10 + digitSum(int(n / 10)))
else:
return -1 * (abs(n) % 10 + digitSum(int(abs(n) / 10)))
Explanation:
This defines the method
def digitSum( n ):
This returns 0 if the number is 0
<em> if n == 0:
</em>
<em> return 0
</em>
If the number is greater than 0, this recursively sum up the digits
<em> if n>0:
</em>
<em> return (n % 10 + digitSum(int(n / 10)))
</em>
If the number is lesser than 0, this recursively sum up the absolute value of the digits (i.e. the positive equivalent). The result is then negated
<em> else:
</em>
<em> return -1 * (abs(n) % 10 + digitSum(int(abs(n) / 10)))</em>
Answer:
import java.util.Scanner;
public class NestedLoops {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
int numRows;
int numColumns;
int currentRow;
int currentColumn;
char currentColumnLetter;
numRows = scnr.nextInt();
numColumns = scnr.nextInt();
for (currentRow = 0; currentRow < numRows; currentRow++) {
currentColumnLetter = 'A';
for (currentColumn = 0; currentColumn < numColumns; currentColumn++) {
System.out.print(currentRow + 1);
System.out.print(currentColumnLetter + " ");
currentColumnLetter++;
}
}
System.out.println("");
}
}