C Program to find biggest number from three given numbers
The given code is a C program that prompts the user to enter three numbers and then determines the biggest number among them. Here's a breakdown of the code:
#include<stdio.h> int main(void) { int a,b,c,big; printf("Enter three numbers : "); scanf("%d%d%d", &a, &b, &c); if(a>b) { if(a>c) big=a; else big=c; } else { if(b>c) big=b; else big=c; } printf("Biggest number is %d\n",big); return 0; }/*End of main()*/
The given code is a C program that prompts the user to enter three numbers and then determines the biggest number among them. Here's a breakdown of the code:
The program includes the necessary header file stdio.h, which provides input and output functions. The main function is defined as int (integer) and takes no arguments (void).
The variables a, b, and c are declared as integers, representing the three numbers entered by the user. The variable big will store the biggest number.
The printf function displays a prompt asking the user to enter three numbers.
The scanf function reads the three numbers entered by the user and stores them in the variables a, b, and c.
The program then checks the values of a, b, and c to determine the biggest number. It uses nested if statements to compare the numbers and assign the largest one to the variable big.
Finally, the program prints the value of the biggest number using printf, and returns 0 to indicate successful program execution.
Overall, this code determines the largest number among three inputs provided by the user and displays the result.
No comments:
Write comments