fork download
  1. #include<stdio.h>
  2. int main(void){
  3. int i,j,max;
  4.  
  5. max=1;
  6.  
  7. for( i=0 ; i<4 ; i=i+1 ){
  8. printf("Value No.%d:",i+1);
  9. scanf("%d",&j);
  10. while(j<1){
  11. printf("Value is not a positive number\n");
  12. printf("Value No.%d:",i+1);
  13. scanf("%d",&j);
  14. }
  15. if(j>max){
  16. max=j;
  17. }
  18. }
  19. printf("The maximum value is %d\n",max);
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Value No.1:Value No.2:Value No.3:Value No.4:The maximum value is 5310