How do I get rid of the spaces in my code output?
The code is written correctly and works but its putting spaces where spaces shouldn't go.
Error results :
http://prntscr.com/cknqp6
My Code:
#include <stdio.h>
int main(void){
int total=0;
int howmany;
int i;
int value;
printf("Enter sequence size: ");
scanf("%d",&howmany);
for(i=1;i<=howmany;i++){
printf(" Enter your value: ", i);
scanf("%d",&value);
total+=value;
}
printf(" The sum of the sequence is: %d",total);
}
Hi,
You have given a space before the first letter of your output
|
printf(" Enter your value: ", i);
|
should be
printf("Enter your value: ", i);
same goes for
printf(" The sum of the sequence is: %d",total);
PS: Please use code tags
http://www.cplusplus.com/articles/jEywvCM9/
Topic archived. No new replies allowed.