Competitive_Set_478

u/Competitive_Set_478


#include<stdio.h>
int main()
{
    float n;
    int i=0;
    printf("Enter a float value:\n");
    scanf("%f", &n);
    do{

        if(n != (int)n)
        {
             n *= 10;
        }
        else{
           while(n!=0)
             {
                 n /= 10;
                 i++;
             }
             printf("The number of digits is %d", i);
             break;
        }
    }while(1);

    return 0;
}

OUTPUT is:

Enter a float value:

3.12

The number of digits is 48

125

#include<stdio.h>
int main() {


    int n, a, b;


    printf("Enter n: \n");
    scanf("%d", &n);


    a = n % 5;


    if (a == 0) {
       
        b = n/5;
        printf("%d", b);
    }


    else {
        b = n/5 + 1;
        printf("%d", b);
    }


    return 0;
}

I tried the below but it shows error at the 'a == 0' line: expression must be a modifiable value

what do i do and what is wrong with this?

#include<stdio.h>
int main() {


    int n, a, b;

    printf("Enter n: \n");
    scanf("%d", &n);

    a = n % 5;

  
518