fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main (){
  5. int dia, mes, ano;
  6. char data_mes, data_dia, data_ano,total_dias_mes, resultado;
  7. printf ("Digite um dia:");
  8. scanf ("%i", &dia);
  9. printf ("Digite um mes:");
  10. scanf ("%i", &mes);
  11. printf ("Digite um ano:");
  12. scanf ("%i", &ano);
  13.  
  14. if (dia>=1 && dia<=31){
  15. data_dia = 'valida';
  16. }
  17. else {
  18. data_dia = 'invalida';
  19. }
  20. if (mes>=1 && mes<=12){
  21. data_mes = 'valida';
  22. }
  23. else {
  24. data_mes = 'invalida';
  25. }
  26. if (mes=1||mes=3||mes=5||mes=7||mes=8||mes=10||mes=12){
  27. total_dias_mes = 'O mes eh de 31 dias';
  28. }
  29. else if (mes=4||mes=6||mes=9||mes=11){
  30. total_dias_mes = 'O mes eh de 30 dias';
  31. }
  32. else if (mes=2){
  33. if ((ano%4==0)&& (ano%100!=0)||(ano%400==0)){
  34. total_dias_mes='O ano eh bissexto e tem 29 dias';
  35. }
  36. else {
  37. total_dias_mes = 'O mes eh de 28 dias';
  38. }
  39. }
  40.  
  41. if (ano>=1){
  42. data_ano = 'valida';
  43. }
  44. else {
  45. data_ano = 'invalida';
  46. }
  47.  
  48. if (data_dia = 'valida' && data_mes = 'valida' && data_ano = 'valida'){
  49. resultado = 'VALIDA';
  50. }
  51. else {
  52. resultado = 'INVALIDA';
  53. }
  54. printf ("O dia, o mes e ano digitado forma uma data: %c", resultado);
  55. system ("pause");
  56. return 0;
  57. }
  58.  
  59.  
  60.  
  61.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:15:12: warning: character constant too long for its type
prog.c: In function ‘main’:
prog.c:15: warning: overflow in implicit constant conversion
prog.c:18:12: warning: character constant too long for its type
prog.c:18: warning: overflow in implicit constant conversion
prog.c:21:12: warning: character constant too long for its type
prog.c:21: warning: overflow in implicit constant conversion
prog.c:24:12: warning: character constant too long for its type
prog.c:24: warning: overflow in implicit constant conversion
prog.c:26: error: lvalue required as left operand of assignment
prog.c:27:18: warning: character constant too long for its type
prog.c:27: warning: overflow in implicit constant conversion
prog.c:29: error: lvalue required as left operand of assignment
prog.c:30:18: warning: character constant too long for its type
prog.c:30: warning: overflow in implicit constant conversion
prog.c:32: warning: suggest parentheses around assignment used as truth value
prog.c:33: warning: suggest parentheses around && within ||
prog.c:34:20: warning: character constant too long for its type
prog.c:34: warning: overflow in implicit constant conversion
prog.c:37:22: warning: character constant too long for its type
prog.c:37: warning: overflow in implicit constant conversion
prog.c:42:12: warning: character constant too long for its type
prog.c:42: warning: overflow in implicit constant conversion
prog.c:45:12: warning: character constant too long for its type
prog.c:45: warning: overflow in implicit constant conversion
prog.c:48:16: warning: character constant too long for its type
prog.c:48:39: warning: character constant too long for its type
prog.c:48:62: warning: character constant too long for its type
prog.c:48: error: lvalue required as left operand of assignment
prog.c:49:13: warning: character constant too long for its type
prog.c:49: warning: overflow in implicit constant conversion
prog.c:52:13: warning: character constant too long for its type
prog.c:52: warning: overflow in implicit constant conversion
prog.c:8: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
prog.c:10: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
prog.c:12: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result
prog.c:55: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result
stdout
Standard output is empty