We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C
- Conditionals and Loops
- For Loop in C
- Discussions
For Loop in C
For Loop in C
Sort by
recency
|
839 Discussions
|
Please Login in order to post a comment
This challenge is a great way to practice using the for loop and conditional statements effectively. 11xplay Pro Login
include
void digitnames(int n){ char *digitNames[] = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
} void oddeven(int m){ int odd,even; if(m%2==0){ printf("even\n"); }else{printf("odd\n");} } int main() { int digitstore[2]; for (int i = 0; i < 2; i++) { scanf("%d", &digitstore[i]); }
* oddeven(digitstore[i]); }
}
include
include
include
include
int main() { int a,b,i; scanf("%d%d",&a,&b); char* mydata[]={"zero","one","two","three","four","five","six","seven","eight","nine"}; if(a>=0 && a<=9){ printf("%s\n",mydata[a]); } if(b>=0 && b<=9){ printf("%s\n",mydata[b]); } if(a%2==0){ printf("even\n"); }else{ printf("odd\n"); } if(b%2==0){ printf("even\n");
include
include
include
include
int main() { int a,b,i; scanf("%d%d",&a,&b); char* mydata[]={"zero","one","two","three","four","five","six","seven","eight","nine"}; if(a>=0 && a<=9){ printf("%s\n",mydata[a]); } if(b>=0 && b<=9){ printf("%s\n",mydata[b]); } if(a%2==0){ printf("even\n"); }else{ printf("odd\n"); } if(b%2==0){ printf("even\n");