As per mentioned the actual problem in the comments, I have edited the code and written it according to the things you described.
#include<stdio.h>
void main()
{
int count = 0;
int i = 0;
int count_digits=0;
char output[50]; //For storing the input
scanf("%d",&count);
while(i < count)
{
printf("\n\nInput:%d ",i+1); //For printing the input number.
scanf("%s",&output); //taking input as a String
int char_no=0; //character no pointer
count_digits=0; //for counting number of characters (in our case : Digits) before decimal points which is then to be printed after decimal points
while(output[char_no]!='\0' && output[char_no]!='.') //printing all digits before decimal point or print whole number if it doesn't contain decimal point
{
printf("%c",output[char_no]); //printing character(Digit)
char_no++; //incrementing character number
count_digits++; //Counting total number of digits before decimal point
}
if(output[char_no]!='\0') //If it is not the end of character array means number contains decimal point
{
printf("%c",output[char_no]); //printing decimal point as a character
char_no++; //Incrementing character pointer
}
else
printf("."); //If number doesn't contain decimal point it will print it.
while(count_digits>0 && output[char_no]!='\0') //loop will run till no of digits after decimal point gets printed or reaching at the end of input
{
printf("%c",output[char_no]); //printing the character as it is
char_no++; //incrementing character number
count_digits--; //decrementing total no of digits to be printed after decimal point as one character gets printed.
}
while(count_digits>0) //if input ends but still the no of digits after decimal points are less than the no. of digits before decimal points, It will print zeros to make no.of digits after and before decimal points equal
{
printf("0"); //printing 0
count_digits--; //decrementing total no of digits to be printed after decimal point as one character gets printed.
}
i++;
}
}
Sample Output for the above is:
Hope this will solve your problem.