If-Else
1-Escriu un programa C que llegeixi del teclat un caràcter i haurà de dir si aquest és o no un
dígit ( o 1 2 3 4 5 6 7 8 9 ).
#include <stdio.
h>
#include <stdlib.
h>
//prototipus de les funcions
int main()
{
char a;
printf("\n...
More
If-Else
1-Escriu un programa C que llegeixi del teclat un caràcter i haurà de dir si aquest és o no un
dígit ( o 1 2 3 4 5 6 7 8 9 ).
#include <stdio.
h>
#include <stdlib.
h>
//prototipus de les funcions
int main()
{
char a;
printf("\n introdueix un caràcter");
scanf(" %c", & a);
if(a>=48 && a<=57)
printf("\n es un digit");
else
printf("\n si no es un digit");
printf("\n\t *** FI DEL PROGRAMA ***\n");
system("pause");
return 0;
}
2-Escriu un programa C que llegeixi del teclat un caràcter i haurà de dir si aquest és o no un
caràcter alfabètic en majúscules:
#include <stdio.
h>
#include <stdlib.
h>
//prototipus de les funcions
int main()
Less