To retrieve the Azure VM OS using Azure CLI, we can use the “az vm” command but before that, need to make sure that you are connected to the Azure cloud and the subscription.PS C:\> az vm show -n VMName -g VMRG --query "[storageProfile.imageReference.offer]" -otsvORPS C:\> az vm show -n VMName -g VMRG --query storageProfile.imageReference.offer - otsvOutputWindowsServerTo get the OS SKU or the operating system version, you can use, PS C:\> az vm show -n VMName -g VMRG --query "[storageProfile.imageReference.sku]" -otsvOutput2016-DatacenterYou can also use the below command to get the OS of the VM without providing the resource group name.PS C:\> ... Read More
Structure is a collection of different datatype variables, grouped together under a single name.Features of structureThe features of structure in the C programming language are as follows −It is possible to copy the contents of all the structure elements of different datatypes to another structure variable of its type by using an assignment operator.For handling the complex datatypes, it is better to create structure within another structure, which is called nested structures.It is possible to pass an entire structure, individual elements of structure and an address of structure to a function.It is possible to create structure pointers.ProgramFollowing is the C ... Read More
The user has to enter the order of two matrices and elements of two matrices. Then, these two matrix are compared.If both matrix elements and size are equal, then it displays that the two matrices are equal.If size of matrix is equal but the elements are not equal, then it displays that the matrix can be compared but is not equal.If the size and elements are not matched, then it displays that the matrices cannot be compared.ProgramFollowing is the C program to compare if the two matrices are equal or not −#include #include main(){ int A[10][10], B[10][10]; ... Read More
ProblemWrite a code to sort all the rows of matrix in an ascending order and all columns in the descending order. The size of matrix and elements of matrix are given by user at runtime.SolutionThe solution to sort all the rows of matrix in an ascending order and all columns in the descending order in the C programming language is explained below −The logic used to sort the rows in an ascending order is as follows −for (i=0;i
ProblemWe need to write a code to interchange the main diagonal elements with the secondary diagonal elements. The size of the matrix is given at runtime.If the size of matrix m and n values are not equal, then it prints that the given matrix is not a square.Only a square matrix can interchange the main diagonal elements and can interchange with the secondary diagonal elements.SolutionThe solution to write a C program to interchange the diagonal elements in given matrix is as follows −The logic to interchange the diagonal elements is explained below −for (i=0;i
ProblemWrite a program to accept a one-dimensional array of N elements and split into two halves. Later on, sort the first half in an ascending order and the second half into descending order.SolutionThe solution to perform the two operations on two halves’ in a single array in C programming language is explained below −The logic used to sort the first half in an ascending order is as follows −for (i=0; i
ProblemFind the areas of rectangle, square, triangle, circle by using the switch case statement, User need to enter base, height, side, radius, breadth and length at runtime to calculate the areas of all geometrical figures.SolutionThe solution to find the areas of rectangle, square, triangle, circle by using the switch case statement is explained below −FormulaeThe formulae for finding the areas of the respective geometrical figures are as follows −Area of rectangle = breadth *length;Area of square = side * side;Area of circle = 3.142*radius*radius;Area of triangle = 0.5 *base*height;ExampleFollowing is the C program to find the areas of rectangle, square, ... Read More
ProblemCompute the value of xn , where x and n both are the inputs given by the user at runtimeSolutionThe solution to generate the value of x power n by using the recursive function in C programming language is as follows −The logic to find xn is mentioned below −//Calling function: Xpow=power(x, n); //Called function: if (n==1) return(x); else if ( n%2 == 0) return (pow(power(x, n/2), 2)); /*if n is even*/ else return (x*power(x, n-1));AlgorithmRefer an algorithm given below to generate the value of x power n by using the recursive function.Step 1 − Read long ... Read More
The general form of the for statement is as follows −for (initialization; condition; operation) statement;Initialization is an assignment statement which is used to set the loop control variable.Condition is a relational expression that determines when the loop exits.The operation defines that how the loop variable changes each time when the loop is repeated.In for loops, the conditional test is performed at the top of the loop. This means that the code inside the loop may not be executed when the condition is false.To begin with as in the following example −x = 10; for (y=10; y != x; ++y) printf ... Read More
The exit () function is used to break out of a loop. This function causes an immediate termination of the entire program done by the operation system.The general form of the exit() function is as follows −void exit (int code);The value of the code is returned to the calling process, which is done by an operation system. Generally, zero is used as return code to indicate normal program termination.ExampleFollowing is the C program for use of exit() function −#include void main(){ char ch; printf("B: Breakfast"); printf("L: Lunch"); printf("D: Dinner"); printf("E: Exit"); printf("Enter your choice:"); ... Read More
 Data Structure
 Networking
 RDBMS
 Operating System
 Java
 iOS
 HTML
 CSS
 Android
 Python
 C Programming
 C++
 C#
 MongoDB
 MySQL
 Javascript
 PHP