1>C- program to find smallest between two number. # programming 5 axis cnc
![]() |
c-language program |
#include<conio.h>
Void main()
{
int a, b;
clrscr();
printf(“Enter the value of a and b”);
scanf(“%d%d”,&a,&b);
if(a<b)
Printf(“smallest number is =%d”,a);
else
printf(“Smallest number is=%d”,b);
getch();
}
Input= Enter the value of a, and b
5
2
Output= smallest number is=2
![]() |
output |
2>How to Write a C- program to find out smallest from 3- numbers.
#include<stdio.h>
#include<conio.h>
Void main()
{
int a,
b,c,small;
clrscr();
printf(“Enter the value of a, b and c”);
scanf(“%d%d%d”,&a,&b,&c);
if(a<b)
small=a;
else
small=b;
if(small<c)
printf(“smallest number
is=%d”,small);
else
printf(“smallest number is=%d”,c);
getch();
}
Input= Enter the value of a, b and c
1
2
5
Output= Smallest
number is= 1
![]() |
c-language program |
![]() |
output |
3>How to Write a C- program to find out smallest from n- numbers.
#include<stdio.h>
#include<conio.h>
Void main()
{
int
a,n,i,small=32767;
Clrscr();
Printf(“Enter the number
in which you want to find
smallest \n”);
Scanf (“%d”,&n);
Printf(“Enter the numbers \n” );
For(i=1; i<=n; i++)
{
scanf(“%d”,&a);
If(a<small)
small=a;
else
small=small;
}
Printf(“smallest number
is =%d”,small);
getch();
}
Input= Enter the
number in which you want to find
smallest .
5
Enter the numbers
2
3
4
1
5
Output= Smallest number is = 1
![]() |
c-language program |
![]() |
output |
0 Comments