findddout / C

0 stars 0 forks source link

C #1

Open findddout opened 2 months ago

findddout commented 2 months ago

include

int main(void){ int x; int y; int m; int R[20]; int i;

printf("Please enter a decimal number");
scanf("%d",&x);

m = x;

for(i = 0; m != 1 ; i++)
{
    R[i] = m % 2;
    m = m / 2;

}

    //printf("1");
    R[i]=1;

    for (int j = i; j >= 0; j--)
    {
        printf("%d",R[j]);
    }

return 0;

}

findddout commented 2 months ago

include

int main(void){ int x; int i; int y; int z;

printf("Please enter a number");
scanf("%d",&x);

for(i=2; i <= x; i++){
    //printf("%d\n",i);
    z = x % i;
    //printf("%d",z);

        if(z==0 && i != x){
            printf("This is not prime number");
            break;
        }else if(z == 0 && i ==x){
            printf("This is prime number.\n");
            break;
        }//else {
            //printf("error.\n");
        //}//if
}//for
return 0;

}

findddout commented 2 months ago

include

int main(void){ int x; int y;

printf("Please enter a month number");
scanf("%d",&x);

if(x == 1){
    printf("January\n");
}
else if(x == 2){
    printf("February\n");
}
else if(x == 3){
    printf("March\n");
}
else if(x == 4){
    printf("April\n");
}
else if(x == 5){
    printf("May\n");
}
else if(x == 6){
    printf("Jun\n");
}
else if(x == 7){
    printf("July\n");
}
else if(x == 8){
    printf("August\n");
}
else if(x == 9){
    printf("September\n");
}
else if(x == 10){
    printf("Octobar\n");
}
else if(x == 11){
    printf("November\n");
}
else if(x == 12){
    printf("December\n");
}

return 0;

}

findddout commented 2 months ago

include

int main(void){ int x; int i; int y; int z=1;

printf("Please enter a number");
scanf("%d\n",&x);// accept a number
for (i = x;i > 0; i--){

    printf("%d",i);
    z = z * i;//factorial
}

printf("Factorial of a number is:%d\n",z);//out put an answer

return 0;

}

findddout commented 2 months ago

include

int main(void){ int x; int i; int y; int z=0; int w;

printf("How many number do you want to enter?");

scanf("%d",&x);

for (i = 0; i < x; i++){
    printf("\nNo.%d",i);
    scanf("%d",&y);
    z = z+y;
    //i++
    //until hear enter number.

}

  printf("Total number is:%d\n",z);
  //untill here method of total number

    w = z+y/z*100;

    printf("Percentage of each%d\n",w);

return 0;

}

findddout commented 2 months ago

include

int main(void){ int x; int i; int R[20]; int j; int m;

printf("Please enter a number");
scanf("%d",&x);

m = x;

for(i = 0; m != 1; i++)
{
    R[i] = m % 2;
    m = m / 2;
}

    R[i] = 1;

    for(j = i; j >= 0; j--)
    {
        printf("%d",R[j]);
    }

return 0;

}

findddout commented 2 months ago

include

int main(void){

int x;
int i;
int z;

printf("Please enter a number");
scanf("%d",&x);

for(i = 2; i <= x; i++)
{

    z = x % i;

    if(z == 0 && i != x) {
        printf("This is not prime number");
        break;
    }
    else if (z == 0 && i == x){
        printf("This is prime number.\n");
        break;

    }

}

return 0;

}

findddout commented 2 months ago

include

int main(void){

int x;

printf("Please enter a number");
    scanf("%d",&x);

    if (x == 1)
    {
        printf("\nJanuary\n");
    }
    else if (x == 2)
    {
        printf("\nFebruary\n");
    }
    else if (x == 3)
    {
        printf("\nMarch\n");
    }
    else if (x == 4)
    {
        printf("\nApril\n");
    }
    else if (x == 5)
    {
        printf("\nMay\n");
    }
    else if (x == 6)
    {
        printf("\nJune\n");
    }
    else if (x == 7)
    {
        printf("\nJuly\n");
    }
    else if (x == 8)
    {
        printf("\nAugust\n");
    }
    else if (x == 9)
    {
        printf("\nSeptember\n");
    }
    else if (x == 10)
    {
        printf("\nOctober\n");
    }
    else if (x == 11)
    {
        printf("\nNovember\n");
    }
    else if (x == 12)
    {
        printf("\nDecember\n");
    }

return 0;

}

findddout commented 2 months ago

include

int main(void){ int x; int i; int z=1;

printf("Please enter a number");
scanf("%d",&x);

for(i = x; i > 0; i--)
{
    printf("%d",i);
    z = z * i; 
}
    printf("Fuctual number is:%d\n",z);

return 0;

}

findddout commented 2 months ago

include

int main(void){

int x;
int i;
int y;
int b[20];
int w;
int z=0;
int j;
int a;

printf("How many number do you want to enter?");
scanf("%d-",&x);

for (i = 0; i < x; i++){
    //printf("%d-",i);
    scanf("%d-",&y);
    z = z+y;
    b[i]=y;

}
    printf("Total number is:%d\n",z);

    for(j = 0; j < i ; j++)
    {

        w = b[i]/z/100;
        printf("%d\n",w);
    }

    printf("Percentage of each%dparcent\n",w);

return 0;

}