SET OF PROGRAMS

This blog provided "C" programs for beginners. Providing c programs for students.enjoy this blog.this blog include many c programs for engineering students, IT engineering students and programmers this blog is very useful.this blog post daily 1-5 programs for you.this programs use full for devlop games devlops application and much more. This blog programs useful for projects because all programs post with explanations.

Search Bar

Ads Here

Saturday, 5 May 2018

C program of biggest of three numbers

Biggest of three numbers C program
#include<stdio.h>
main()
{
  int num1,num2,num3;
  printf("Enter a number 1\n");
  scanf("%d",&num1);
  printf("Enter a number 2\n");
  scanf("%d",&num2);
  printf("Enter a number 3\n");
  scanf("%d",&num3);
  if((num1>num2) && (num1>num3))
  {
     printf("%d is bigger\n",num1);
  }
  else if((num2>num1) && (num2>num3))
  {
    printf("%d is bigger\n",num2);
  }
  else
  {
    printf("%d is bigger\n",num3);
  }
}
Output:
Enter a number 1
-200
Enter a number 2
345
Enter a number 3
123
345 is bigger
Explanation:
  1. Initializes :
    • num1-for storing number 1
    • num2-for storing number 2
    • num3- for storing number 3
  2. Using if to check whether the number 1(num1) is greater than both num2 and num3 and if num1 is greater it is printed as bigger of the three numbers.
  3. The same step above is repeated for num2 andnum3.

No comments:

Post a Comment