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.
Conditional Statements in C
Conditional Statements in C
Sort by
recency
|
536 Discussions
|
Please Login in order to post a comment
Shouldn't we free n_str before exiting?
include
int main() { int a; scanf("%d",&a); switch (a) { case 0: printf("zero"); break; case 1: printf("one"); break; case 2: printf("two"); break; case 3: printf("three"); break; case 4: printf("four"); break; case 5: printf("five"); break; case 6: printf("six"); break; case 7: printf("seven"); break; case 8: printf("eight"); break; case 9: printf("nine"); break; default: printf("Greater than 9");; } }
include
include
int main() { int a; scanf("%d", &a);
}
int main(){ int n; scanf("%d",&n); if(n>9){ printf("Greater than 9"); }else{ char array[10][10]={"zero","one","two","three","four","five","six","seven","eight","nine"}; printf("%s",array[n]); } }