Answer:
I'm better at C++, but I'm pretty sure this it:
/*C - Program to compare two strings
character by character.*/
#include<stdio.h>
int main(){
char str1[]="Hello";
char str2[]="Hello";
int len1=0, len2=0;
int i,isSame=0;
//calculate lengths
i=0;
while(str1[i++]!='\0') len1++;
i=0;
while(str2[i++]!='\0') len2++;
if(len1!=len2){
printf("Strings are not same, lengths are different\n");
return -1;
}
isSame=1;
for(i=0;i<len1;i++){
if(str1[i]!=str2[i]){
isSame=0;
break;
}
}
if(isSame)
printf("Strings are same.\n");
else
printf("Strings are not same.\n");
return 0;
}
Answer:
lst = []
n = int(input("Input an array size for you words array: "))
print("Now please enter " + str(n) + " words")
max = 0
min = 1000
index_min = 0
index_max = 0
for i in range(n):
s = input("Input a word: ")
lst.append(s)
if len(s) >= max:
max = len(s)
index_max = i
if len(s) <= min:
min = len(s)
index_min = i
print("The longest word is :" + lst[index_max])
print("The shortest word is :" + lst[index_min])
Explanation:
Create an empty list, lst
Get the size from the user
Create a for loop that iterates "size" times
Inside the loop, get the strings from the user and put them in the lst. Find the longest and shortest strings and their indices using if structure.
When the loop is done, print the longest and shortest
Correct, debit cards use money you already have. Credit cards basically 'loan' money, which can lead to debt if you overuse it or fail to pay it off
Answer:
See explanation
Explanation:
Given
The above program that subtracts two numbers and returns the result
Required
Modify the source code to run perfectly
When the given program is tested, it displays
<em>4 minus 10 equals -6
</em>
<em></em>
<em>Which is different from the expected output of</em>
<em>10 minus 4 equals 6
</em>
<em></em>
Modify
<em>solution = minuend-subtrahend
</em>
<em>to</em>
<em>solution = subtrahend - minuend</em>
<em></em>
And that does it.
False. horizontal can be used for landscape pictures to create a depth effect