Answer:
Following is the program in C language :
#include <stdio.h> // header file
#define n 5 // macro
int main() main function
{
int a[n],k1; // variable and array declaration
printf("Enter the element:\n");
for(k1=0;k1<n;++k1) //iterating the loop
{
scanf("%d",&a[k1]);//Read the values by user
}
printf("Output in Reverse Order:\n");
for(k1=n-1;k1>=0;--k1)//iterating the loop
{
printf(" %d ",a[k1]); //Display the values
}
return 0;
}
Output:
Enter the element:
4
3
45
67
89
Output in Reverse Order: 89 67 45 3 4
Explanation:
Following is the description of the program
- Define a macro "n" with value 5 after the header file.
- Declared an array "a" and defined the size of that array by macro i.e "n".
- Read the value by the user by using scanf statement in the array "a"
- Finally In the last for loop display the values of array "a" by space.
Answer:
Module Program
Sub Main()
Dim num As Integer
num = 4
Console.WriteLine("The square of " & num & " is " & num * num)
Console.ReadKey()
End Sub
End Module
Explanation:
Very similar to the other program you posted.