Answer:
Option (4) is the correct answer of this question.
Explanation:
The switch is used to handle the multiple selections in the program when we need to choose on the condition and we have more then one condition arises then we have used the switch statement in the PHP.
Syntax of using Switch:-
switch(variable)
{
case 1. statement
Break;
..................
default :
case n:
statement n
}
Other options do not use multiple selections so they are incorrect options.
Answer:
ok I've got the answer sheet on the picture I will attach
Explanation:
I had to crop to size on my computer and found them all
Answer:
#include <stdio.h>
#include <string.h>
int main(){
char number[100];
printf("Number: ");
scanf("%s", number);
int sum = 0;
for(int i =0;i<strlen(number);i++){
sum+= number[i] - '0';
}
printf("Sum: %d",sum);
return 0;
}
Explanation:
This declares a c string of 100 characters
char number[100];
This prompts user for input
printf("Number: ");
This gets user input
scanf("%s", number);
This initializes sum to 0
int sum = 0;
This iterates through the input string
for(int i =0;i<strlen(number);i++){
This adds individual digits
sum+= number[i] - '0';
}
This prints the calculated sum
printf("Sum: %d",sum);
return 0;
Answer:
C
Explanation:
Predicate methods typically test a condition and do not modify the object on which they're called.