Untitled
unknown
c_cpp
a year ago
645 B
6
Indexable
// Online C compiler to run C program online
#include <stdio.h>
//2541
void stampa_formato(int val, char car)
{
int divisore = 1;
//Sto trovando il divisore giusto per la cifra più significativa
while(val / divisore >= 10)
{
divisore *=10;
}
while(divisore > 0)
{
int cifra = (val / divisore) % 10;
for(int i=0; i<cifra; i++)
{
printf("%c", car);
}
printf("\n");
divisore = divisore / 10;
}
}
int main() {
int val = 2541;
char car = '*';
stampa_formato(val, car);
return 0;
}Editor is loading...
Leave a Comment