subject

Consider the following two code segments. in both, assume that n is an integer variable that has been declared and initialized. segment 1 int prod = 1; int i; for (i = 2; i < = n; i++) { prod *= i; } system. out. println(prod); segment 2 int prod = 1; int i = 2; while (i < = n) { prod *= i; i++; } system. out. println(prod); for which integer values of n do these code segments print the same result?

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 16:00
Page orientation can be either landscape or
Answers: 1
question
Computers and Technology, 21.06.2019 22:00
Your task this week is to write a very simple spam classifier in python. it will classify messages as either spam (unwanted) or ham (wanted). the program will have a set of spam_words, words that are known to appear in spam messages. that set is included in the template file spam.pypreview the document. you will also define a spam threshold which reflects the allowed percentage of spam words in the message. you'll compute a 'spam indicator', which is the ratio of spam words to the total number of unique words in the message. if the spam indicator exceeds the spam threshold, the message is classified as spam. otherwise it is classified as ham. we'll assume that the spam threshold is a constant and has a value of 0.10. your program will prompt the user for a message and then will print the corresponding spam indicator with two decimal digits and the corresponding classification (spam or ham). the program will be case insensitive. the spam words are detected whether they are in lower case or upper case or mixed case. each word, spam or not, is counted once (even if it appears multiple times in the message.) the program will remove punctuation from the message before identifying the words and computing the spam indicator. for example '! ' must be identified as the spam word 'now'.
Answers: 3
question
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
Write pseudocode to represent the logic of a program that allows the user to enter a value. the program multiplies the value by 10 and outputs the result.
Answers: 1
You know the right answer?
Consider the following two code segments. in both, assume that n is an integer variable that has bee...
Questions
question
Mathematics, 18.02.2021 22:40
question
Mathematics, 18.02.2021 22:40
question
Mathematics, 18.02.2021 22:40
question
Mathematics, 18.02.2021 22:40
Questions on the website: 13722361