6-10
#include
{int i,j,upp,low,dig,spa,oth; char text[3][80];
upp=low=dig=spa=oth=0; for (i=0;i<3;i++)
{ printf(\ gets(text[i]);
for (j=0;j<80 && text[i][j]!='\\0';j++) {if (text[i][j]>='A'&& text[i][j]<='Z') upp++;
else if (text[i][j]>='a' && text[i][j]<='z') low++;
else if (text[i][j]>='0' && text[i][j]<='9') dig++;
else if (text[i][j]==' ') spa++; else oth++; } }
printf(\ printf(\ printf(\ : %d\\n\ printf(\ : %d\\n\ printf(\ : %d\\n\ return 0; }
6-12a-c
#include
char ch[80],tran[80];
printf(\ gets(ch);
printf(\ :%s\ j=0;
while (ch[j]!='\\0')
{ if ((ch[j]>='A') && (ch[j]<='Z')) tran[j]=155-ch[j];
else if ((ch[j]>='a') && (ch[j]<='z')) tran[j]=219-ch[j]; else
tran[j]=ch[j]; j++; } n=j;
printf(\ for (j=0;j #include char ch[80]; printf(\ gets(ch); printf(\ j=0; while (ch[j]!='\\0') { if ((ch[j]>='A') && (ch[j]<='Z')) ch[j]=155-ch[j]; else if ((ch[j]>='a') && (ch[j]<='z')) ch[j]=219-ch[j]; else ch[j]=ch[j]; j++; } n=j; printf(\ for (j=0;j #include { char s1[80],s2[40]; int i=0,j=0; printf(\ scanf(\ printf(\ scanf(\ while (s1[i]!='\\0') i++; while(s2[j]!='\\0') s1[i++]=s2[j++]; s1[i]='\\0'; printf(\ return 0; } 7-1-1 #include {int hcf(int,int); int lcd(int,int,int); int u,v,h,l; scanf(\ h=hcf(u,v); printf(\ l=lcd(u,v,h); printf(\ return 0; } int hcf(int u,int v) {int t,r; if (v>u) {t=u;u=v;v=t;} while ((r=u%v)!=0) {u=v; v=r;} return(v); } int lcd(int u,int v,int h) { return(u*v/h); } 7-3 #include {int prime(int); int n; printf(\ scanf(\ if (prime(n)) printf(\ else printf(\ return 0; } int prime(int n) {int flag=1,i; for (i=2;i #include { void convert(int array[][3]); int i,j; printf(\ for (i=0;i scanf(\ printf(\ for (i=0;i printf(\ printf(\ } convert(array); printf(\ for (i=0;i printf(\ printf(\ } return 0; } void convert(int array[][3]) {int i,j,t; for (i=0;i array[i][j]=array[j][i]; array[j][i]=t; } } #include {void inverse(char str[]); char str[100]; printf(\ scanf(\ inverse(str); printf(\ return 0; } void inverse(char str[]) {char t; int i,j; for (i=0,j=strlen(str);i<(strlen(str)/2);i++,j--) {t=str[i]; str[i]=str[j-1]; str[j-1]=t; } } 7-6 #include {void concatenate(char string1[],char string2[],char string[]); char s1[100],s2[100],s[100]; printf(\ scanf(\ printf(\ scanf(\ concatenate(s1,s2,s); printf(\ return 0;