CTS
Company
Category
1. Create a method GetMax() with two integer (int) parameters, that returns maximal of the two numbers. Write a program that reads three numbers from the console and prints the biggest of them. Use the GetMax() method you just created. Write a test program that validates that the methods works correctly. Note: This is not a recursive method.
2. write a program that contains a method that reads a string, reverses it and prints it to the console. for example: "introduction" -> "noitcudortni." note: this is not a recursive method.
3. Write a program to generate and print all combinations with duplicates of k elements from a set with n elements. Sample input:
N=3
K=2
Read Solution (Total 2)
-
- 2 ans: #include
#include
main(){
char str[50];
char *rev;
printf("Enter string:");
scanf("%s",str);
rev = strrev(str);
printf("
reverse: %s", rev);
getch();
}
- 10 years agoHelpfull: Yes(3) No(0)
- 1-creating GetMax mathod with two para meter....int
/*c-program*/
int GetMax(int x1,int x2) /*syntax method dec. :- mathod_name(parameter1,parameter2) */
{
int l1=x1,l2=x2; /* assinging to local variable*/
if(l1>l2)
return l1;
else
return l2;
}
- 10 years agoHelpfull: Yes(1) No(0)
CTS Other Question