# C coding a rotate function (help me pleasee)

#### justme123

hello everyone ..
i would really appriciate it if someone would help me with this question..
i upload here the code i wrote, its not really solving anything (i get an really odd outputs),but i would like that someone will explain to me what am i doing wrong ( even if its probably everything )..
so the question is to write an efficiant function that turn the digites from right to left (the user choose the amount of spins he would want to do on a function )
C:
``````#include<stdio.h>
#include<math.h>
int rotateNumber(int number, int spins)
{
int reminder, answer = 0, num =0;
for (int i = spins;i >=0; i--)
{
reminder = number % 10;

}
}

int numberLength(int num)
{
int number = 0, spins = 0;
while (number != 0)
{
{
num = number / 10;
num++;
}
return num;
}
if (spins % num == 0)
{
printf("%d", number);
}
return number;
}
inputIntNonNegative()
{
int number = 0,spins=0;
scanf_s("%d", &number);
while (number < 0)
{
printf("Enter a positive number: ");
scanf_s("%d", &number);
}
return number;
return spins;
}
void main()
{
int number = 0, spins = 0, answer = 0;
number = inputIntNonNegative();
printf("please enter the amount of spins: ");
spins = inputIntNonNegative();
printf("The number %d after %d spins is: %d\n", number, spins, answer);
}``````

Last edited:

#### tea-age.solutions

Can you give some example inputs and their results, e.g. if i have the number
123456 and then what shall be the result for spin 1 or spin 2 or spin 3?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

### Members online

No members online now.