Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1)
- #include <stdio.h>
- int main()
- {
- int n;
- scanf("%d", &n);
- if(n % 2 == 0)
- printf("The Number is even\n");
- else
- printf("The number is odd\n");
- }
- 2)
- #include <stdio.h>
- int main()
- {
- int a , b, c;
- scanf("%d %d %d", &a , &b, &c);
- if(a > b && a > c)
- printf("A is max\n");
- else if(b > c && b > a)
- printf("B is max\n");
- else
- printf("C is max\n");
- }
- 3)
- #include <stdio.h>
- int main()
- {
- int year;
- scanf("%d", &year);
- if ( year%400 == 0)
- printf("%d is a leap year.\n", year);
- else if ( year%100 == 0)
- printf("%d is not a leap year.\n", year);
- else if ( year%4 == 0 )
- printf("%d is a leap year.\n", year);
- else
- printf("%d is not a leap year.\n", year);
- return 0;
- }
- 5)
- #include <stdio.h>
- int main()
- {
- int marks;
- scanf("%d", &year);
- if(marks >= 80 && marks <= 80)
- printf("A+\n");
- else if(marks >= 70 && marks < 80)
- printf("A\n");
- else if(marks >= 60 && marks < 70)
- printf("A-\n");
- else if(marks >= 50 && marks < 60)
- printf("B\n");
- else if(marks >= 40 && marks < 50)
- printf("C\n");
- else
- printf("Fail\n");
- return 0;
- }
- 7)
- #include <stdio.h>
- int main()
- {
- char ch;
- scanf(" %c", &ch);
- switch(ch)
- {
- case 'a':
- printf("Vowel\n");
- break;
- case 'e':
- printf("Vowel\n");
- break;
- case 'i':
- printf("Vowel\n");
- break;
- case 'o':
- printf("Vowel\n");
- break;
- case 'u':
- printf("Vowel\n");
- break;
- default:
- printf("Consonant\n");
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement