Istanvir389

max min

Aug 7th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4. int i,n,num;
  5. printf("Enter number ::");
  6. scanf("%d",&n);
  7. long int max=-9999,min=9999;
  8. for(i=0;i<n;i++)
  9. {
  10. scanf("%d",&num);
  11. if(num>=max)
  12. {
  13. max=num;
  14. }
  15. if(num<=min)
  16. {
  17. min=num;
  18. }
  19. }
  20. printf("Max is%d and min is %d",max,min);
  21. return 0;
  22. }
Add Comment
Please, Sign In to add comment