biker_dev icon

4.6.c

biker_dev | PRO | 01/02/26 11:48:04 AM UTC (Edited) | 0 ⭐ | 20673 👁️ | Never ⏰ | []
C |

480 B

|

Source Code

|

0 👍

/

0 👎

/*
 
4.6 Disequazione
 
Dato un numero reale positivo Y immesso da tastiera, si scriva un programma in 
linguaggio C che determini qual è il massimo numero intero positivo X 
tale per cui sia valida la relazione :
 
X^X ≤ Y
 
*/
 
#include <stdio.h>
#include <math.h>
 
int main(void)
{
    
    int x = 1, y;
 
    printf("Inserisci Y : "); scanf("%d", &y);
 
    while( pow(x,x) <= y ) x++;
 
    x -= 1;
    
    printf("\n%d^%d <= %d\n", x, x, y);
 
    return 0;
 
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎