A
aslamhenry
how to make these program huhu
please any key in 5 digit : 56789
ouput
5678 9
567 89
56 789
5 6789
take a look at my coding...why the ouput is rubbish huhuhu
#include <stdio.h>
int main(void)
{
float num;
int i, j, x ;
printf("please key in any 5 digit number:");
scanf("%f",&num);
for ( i=0 ; 5>i ; ++i){
for(j=0 ; i>j ; ++j){
printf(" ") ;
}
for( x = j+1 ; 5 >= x ; ++x){
printf("%.0f", num);
}
putchar('\n');
}
return 0;
}
please any key in 5 digit : 56789
ouput
5678 9
567 89
56 789
5 6789
take a look at my coding...why the ouput is rubbish huhuhu
#include <stdio.h>
int main(void)
{
float num;
int i, j, x ;
printf("please key in any 5 digit number:");
scanf("%f",&num);
for ( i=0 ; 5>i ; ++i){
for(j=0 ; i>j ; ++j){
printf(" ") ;
}
for( x = j+1 ; 5 >= x ; ++x){
printf("%.0f", num);
}
putchar('\n');
}
return 0;
}