Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
oorrja
GitHub Repository: oorrja/learntosolveit
Path: blob/master/languages/cprogs/Ex_2.10_lowercondit.c
1240 views
1
/* Function lower(c) using conditional expression */
2
3
#include<stdio.h>
4
5
int lower(int c);
6
7
int main(void)
8
{
9
int c;
10
11
while((c=getchar())!=EOF)
12
{
13
putchar(lower(c));
14
}
15
}
16
17
int lower(int c)
18
{
19
return c>='A' && c<='Z'? c+'a'-'A':c;
20
}
21
22
23