Solution with out using functions
Solution with out using functions(another method)
Solution with out using functions(Using Conditional Operator)
Solution using functions without passing arguments
Solution using functions and by passing arguments
Solution : Without using function
Program/Source Code
#include <stdio.h> int main() { int a,b; printf("Enter 2 nos "); scanf("%d %d",&a,&b); if(a<b) printf("Min no = %d",a); else printf("Min no = %d",b); return 0; }
Output:
case :1
Enter 2 nos 25
63
Min no = 25
case :2
Enter 2 nos 14
25
Min no = 14
Solution : Without using function(another method)
Program/Source Code
#include <stdio.h> int main() { int a,b,c; printf("Enter 2 nos "); scanf("%d %d",&a,&b); if(a<b) c=a; else c=b; printf("Min no = %d",c); return 0; }
Output:
Solution : Without using function(Using Conditional Operator)
Program/Source Code
#include <stdio.h> int main() { int a,b,c; printf("Enter 2 nos "); scanf("%d %d",&a,&b); c=(a<b)?a:b; printf("Min no = %d",c); return 0; }
Output:
Solution : Using function Without Passing Arguments
Program/Source Code
#include <stdio.h> void check() { int a,b; printf("Enter 2 nos "); scanf("%d %d",&a,&b); if(a<b) printf("Min no = %d",a); else printf("Min no = %d",b); } int main() { check(); return 0; }
Output:
case :1
Enter 2 nos 425
23
Min no = 23
case :2
Enter 2 nos 141
651
Min no = 141
Solution : Using function Passing Arguments
Program/Source Code
#include <stdio.h> void check(int a,int b) { if(a<b) printf("Min no = %d",a); else printf("Min no = %d",b); } int main() { int a,b; printf("Enter 2 nos "); scanf("%d %d",&a,&b); check(a,b); return 0; }
Output:
case :1
Enter 2 nos 125
63
Min no = 63
case :2
Enter 2 nos 14
251
Min no = 14
Previous:
Next: |
Tutorials | Technical Questions | Interview Questions |
---|---|---|
C Programming C++ Programming Class 11 (Python) Class 12 (Python) |
C Language C++ Programming Python |
C Interview Questions C++ Interview Questions C Programs C++ Programs |