Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
numerodevecesquerepitedigitoennumero
#include <stdio.h> #include <stdlib.h> int main(void) { long long N; short d, b; int cifra,i; printf("Introduce un valor entero = "); scanf(" %lld", &N); printf("Introduce un valor (0-9) = "); scanf(" %hd", &d); i = 0; b = 0; while(N > 0) { cifra = N%10; if (cifra == d) { i = 1; b++; } N = N/10; } if(i == 1) printf("\nEl numero contiene la cifra (%hd) %hd veces.\n", d, b); else printf("\nEl numero no contiene la cifra (%hd).\n", d); return 0; }
run
|
edit
|
history
|
help
0
C_141210_Funciones
Name pipe
16-bit signed or unsigned int -> ASCII
14th Dec Project1 v0.2
DUE TUESDAY
Print hostname
FahrenheitToCelciusReverse
est
Assignment 4 v3
Bitfield and Union in C - strange results