1:
#include <stdio.h>
///*** positive or negative or zero:
int main()
{
int num;
printf("Enter a number:");
scanf("%d",&num);
if(num > 0) {
printf("The number is positive\n");
}
if(num == 0) {
printf("The number is zero\n");
}
if(num<0) {
printf("The number is negative\n");
}
return 0;
}
output: depend on your value
2:
#include <stdio.h>
///*** prove even odd
int main()
{
int number,sum;
printf("Enter a number:");
scanf("%d",&number);
sum=number%2;
if(sum==0) {
printf("The number is even\n");
}
else {
printf("The number is odd\n");
}
return 0;
}
output: depend on your value
3:
#include <stdio.h>
///*** prove vowel consonant
int main()
{
char alphabet;
printf("Enter a alphabet:");
scanf("%c",&alphabet);
if(alphabet=='a'){
printf("It is vowel");
}
if(alphabet=='e'){
printf("It is vowel");
}
if(alphabet=='i'){
printf("It is vowel");
}
if(alphabet=='o'){
printf("It is vowel");
}
if(alphabet=='u'){
printf("It is vowel");
}
else {
printf("It is consonant");
}
return 0;
}
output: depend on your value
No comments:
Post a Comment