Advertisement
raihan02

Untitled

Dec 13th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. 1)
  2. #include <stdio.h>
  3. int main()
  4. {
  5. int n;
  6. scanf("%d", &n);
  7. if(n % 2 == 0)
  8. printf("The Number is even\n");
  9. else
  10. printf("The number is odd\n");
  11.  
  12. }
  13. 2)
  14. #include <stdio.h>
  15. int main()
  16. {
  17. int a , b, c;
  18. scanf("%d %d %d", &a , &b, &c);
  19. if(a > b && a > c)
  20. printf("A is max\n");
  21. else if(b > c && b > a)
  22. printf("B is max\n");
  23. else
  24. printf("C is max\n");
  25.  
  26. }
  27. 3)
  28. #include <stdio.h>
  29.  
  30. int main()
  31. {
  32. int year;
  33.  
  34. scanf("%d", &year);
  35.  
  36. if ( year%400 == 0)
  37. printf("%d is a leap year.\n", year);
  38. else if ( year%100 == 0)
  39. printf("%d is not a leap year.\n", year);
  40. else if ( year%4 == 0 )
  41. printf("%d is a leap year.\n", year);
  42. else
  43. printf("%d is not a leap year.\n", year);
  44.  
  45. return 0;
  46. }
  47. 5)
  48. #include <stdio.h>
  49.  
  50. int main()
  51. {
  52. int marks;
  53.  
  54. scanf("%d", &year);
  55. if(marks >= 80 && marks <= 80)
  56. printf("A+\n");
  57. else if(marks >= 70 && marks < 80)
  58. printf("A\n");
  59. else if(marks >= 60 && marks < 70)
  60. printf("A-\n");
  61. else if(marks >= 50 && marks < 60)
  62. printf("B\n");
  63. else if(marks >= 40 && marks < 50)
  64. printf("C\n");
  65. else
  66. printf("Fail\n");
  67.  
  68. return 0;
  69. }
  70. 7)
  71. #include <stdio.h>
  72.  
  73. int main()
  74. {
  75. char ch;
  76. scanf(" %c", &ch);
  77. switch(ch)
  78. {
  79. case 'a':
  80. printf("Vowel\n");
  81. break;
  82. case 'e':
  83. printf("Vowel\n");
  84. break;
  85. case 'i':
  86. printf("Vowel\n");
  87. break;
  88. case 'o':
  89. printf("Vowel\n");
  90. break;
  91. case 'u':
  92. printf("Vowel\n");
  93. break;
  94. default:
  95. printf("Consonant\n");
  96. break;
  97. }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement