#include
using namespace std;
void rev(int start, int end, int arr[])
{
while(start < end)
{
int temp = arr[start];
arr[start] = arr[end];
arr[end] = temp;
start++;
end--;
}
}
void printArray(int arr[], int size)
{
for(int i = 0; i < size; i++)
cout << arr[i] << " ";
cout << endl;
}
int main()
{
int arr[] = {1, 3, 5, 6, 7, 9};
int size = sizeof(arr) / sizeof(arr[0]);
// Print the original array
cout << "original array is: ";
printArray(arr, size);
// Function calling
rev(0, size-1, arr);
cout << "Reversed array is: ";
// Print the Reversed array
printArray(arr, size);
return 0;
}
fun main() {
val border = "`-._,-'"
val timesToRepeat = 4
printBorder(border, timesToRepeat)
println(" Happy Birthday, Jhansi!")
printBorder(border, timesToRepeat)
}
fun printBorder(border: String, timesToRepeat: Int) {
repeat(timesToRepeat) {
print(border)
}
println()
}
0 Comments