0 like 0 dislike
4.8k views

Please write a program that receives 7 characters aweSOME in the same line. It then changes the first 3 lowercase characters into uppercase and the last 4 uppercase characters into lowercase. Kindly use a given template to finish the task.

Example(template)

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
	char s1,s2,s3,s4,s5,s6,s7; // You can change these declarations, it entirely depends on you.
	printf("Input your characters:\n"); // Do not change this

	// Your conditions start from here
	
	return 0;
}

Input

Input your characters:
aweSOME

Output

AWEsome

Suggestion

You may need a little help from your friendly table, here is ASCII table.

[Exercise] Coding (C) - asked in Chapter 3: Branching, Looping and Functions by (5.9k points)
ID: 29558 - Available when: Unlimited - Due to: Unlimited
| 4.8k views

13 Answers

0 like 0 dislike
Hidden content!
** * * ****** *
** * * * ****

* * * ** * ** ***** or add own * * **** * *** ** * ****** or ** * */

* * * ** ** * {
* **** * ** * * ** * * * * * // * can ** * * **** it * * * on **
** *** ** * * * ** ** * ** * * ** * * // Do * *

* ** * // * * *
* ** **** * *** * * * *
* * ** ** *** * *** **** * *** * ** * * * *** ****** ******** ***** *
*** ***
******** * s1 * *** ** * * **** * s1 ** * ){
* * *** * * ** S1 = s1 + * -
}
**** * ****
** * ** * * * * *** * ** s1 * * **
* ** * * ** * *** * S1 = s1 - * - ***
**** * * ** ** }
* * *
*** *** *** * if( s2 * *** 'a' * ***** * s2 * ** * 'z' ){
** ** *** S2 = s2 + * - * *
* *** * * }
* *** *** ** * * 'A' * * * * s2 ***
** *** **** * * ** * * S2 = s2 - * - *
***** * *** * }
**** * ** * ***
* ** * * if( s3 ** * 'a' * * * ** s3 * * *** ){
*** *** **** * S3 = s3 + * - * *
**** * ** ** }
** ** * * * * * **** * ** **** * s3 * *** *
* ** ** *** * ** * S3 = s3 - * - **
** ** }
* * * *** *
*** ** * * if( s4 * ** 'a' *** s4 * * * 'z' ){
*** * * *** *** *** ** ******* S4 = s4 + * * - **
* *** *** }
** ** * * * * * * ** ** * * *** s4 * **
*** ** *** * * *** * *** * S4 = s4 - ** - *
** ** * }
*** * ** * *
* **** * *** s5 **** ** ***** ** * * s5 ** * ){
* * ** * ** *** *** * * * S5 = s5 + *** - * *
** ***** * }
* * * *** ** * * *** *** * * ** * s5 ** ** **
*** **** * *** * ** S5 = s5 - * * - ***
** ** ** *** * }
* ** * ***
* ** * if( s6 * ** 'a' *** ** * s6 * ** * ** ){
* * ****** **** ***** S6 = s6 + ** - * **
** *** }
* * * * *** * ** ** * ** * ***** * s6 **** *
* * *** *** *** * * * S6 = s6 - - **
**** ** * }
* * **** *
*** * ***** if( s7 ** ** 'a' *** ** * * s7 * * 'z' ){
* *** * * * * *** ** *** S7 = s7 + - ***
*** * ** ** }
** ** *** * **** 'A' **** * * s7 * *
** ** * ** * ** ** * S7 = s7 - * - **
* ** * ** * * }
** ** * ****
* * * *****
*** ** * *** ******** * * ** *** * * *** * * ** **
* ** * ** * 0;
}
100/100 answered by (221 points)
0 0
Case 0: Wrong output
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include ** ****** ***
#include * * * * ** ** **

/* run this program using the console pauser or add your own getch, ***** * * ** * **** or input loop */

int main(int argc, char *argv[]) {
*** *** ** * * * * ** * *

***** *** ** **** * * * * * your * **** **
**** * * ****** ** * ** = getchar();
** **** ** * * = * * *
* * * * *** * **** = getchar();
*** * ** ** = getchar();
*** ** ** ***** * * ** = * *
*** * ** ** ** * * = *** * *
*** * * * * * * ** = getchar();


* ** ** * ** ** * * * *
** *** * **** * ** *****
* *** * ** ** *** *

**** ** *** **** ** *** q >= 'a' ** * *** q <= 'z' )
***** *** * * ** ** * * ** * * *** * **** * ** *** * q + ** * *** - 'a'));
** ** *** *** ** * ** * * ****** * * * * ***** * w >= 'a' ** *** w <= 'z' )
** * ** ** ** * * *** ** * * *** * ** *** w + **** - 'a'));
* ** * ****** * *** * * ** *** *** * * ** * e >= 'a' * ** ** * e <= 'z' )
**** * * * ** ** ** *** * * * *** * * ** * * ** **** * e + *** *** * - 'a'));
***** * * ** ** ** * * ** ** *** *** * * * r >= 'A' * * ***** r <= 'Z' )
******* * ** * * * * ** ** * * * **** * * *** * * ** ** r - ** * *** - 'a'));
* * * * * ** * ** * ***** * * * * **** * * * t >= 'A' ** * * t <= 'Z' )
** * * * * **** * * * ** * ** * * * * * t - * ** * - 'a'));
* ** *** * * * ** ** * ** * **** *** * * * * y >= 'A' * * * * * y <= 'Z' )
*** *** ** * ***** * ** *** ********** * * * * *** * * * y - ******** - 'a'));
** ** ** **** * * ********* **** ** * * * *** u >= 'A' ** ** * * u <= 'Z' )
* * ** * * **** * ** * ******** ** * * ** * * ** u - ******** - 'a'));
**** * ** ** *** * * ** *** * * ** ***
* ** * ***** ** * **

** * * ***** * *** ** ***
** *** * * *** * *** 0;
}
100/100 answered
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include * *** ** * **
#include **** * *


int main(int argc, char *argv[]) {
*** * ** * * * * ***** * q,w,e,r,t,y,u;
*** * * *** **** ** * * ** ** **** * ** * your * * * *** ****
** ** * * * ** * * ** ***** * *** * * ** * * * * **** = getchar();
* * ** * * ** * * * **** * ** **** ***** * * ** *** = getchar();
*** ** ********** * * * * *** **** **** * **** *** **** ** = getchar();
* * * * ** ** ** * * ***** ***** ***** * * ** ** ** *** ** = getchar();
*** * ** * * * * *** * * *** * ** ** * ** * ******** **** = getchar();
* *** *** * * * * ** ** *** ** * * * * * * *** ** * = getchar();
*** * **** *** *** * * * * * * * ** *** ** *** ** ** = getchar();
** **** * **** * **
* * * *** **** * * ************ * ** *** * q >= 'a' * * * * q <= 'z' )
* ** * * * * *** * ** **** *** * ** ***** * ** q +  ('A' - 'a'));
* ** **** * ** * * **** * * ** w >= 'a' ** *** ** * w <= 'z' )
** * **** ** * ** * ** * ** ** *** * * ******** ** * w +  ('A' - 'a'));
* **** * * *** * ***** ** ******* * * e >= 'a' ** ** ** e <= 'z' )
** *** * ****** * * ****** *** * * * ** * *** *** * * * * e +  ('A' - 'a'));
* * ** **** * ** ** ** ****** * ***** * * * * r >= 'A' ** * * * r <= 'Z' )
* * ** ** * * * * * * *** * * * ***** * * *** * * **** * r -  ('A' - 'a'));
* ** *** ** **** * * ** ****** ** * ** * * ***** * t >= 'A' ** * * * ** t <= 'Z' )
* *** **** * * * * * *** ** ** *** **** ** ** * * *** ** t -  ('A' - 'a'));
* ** * ** * *** * **** *** ** * ** ** * y >= 'A' * ** * ** y <= 'Z' )
** * *** ** ** * * *** * * * **** * **** * * ** ** * y -  ('A' - 'a'));
* ****** ** * ** **** * * * ** **** * ** *** u >= 'A' * * ** ** u <= 'Z' )
** * ** * ** *** *** ** ** * * ** **** ********** **** * u -  ('A' - 'a'));
*** ** * ** ** * * * ** * **** *** *** * * ** * *
*** * ** ** * ***** * 0;
}
100/100 answered by (220 points)
edited by
0 0
Case 0: Wrong output
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include * ** * *****
#include * ** ** ** * **

/* run this program using the console pauser or add your own getch, * *** ** *** or input loop */

int main(int argc, char *argv[]) {
******* ** **** *** ** *******

** *** ** * *** * ***** *** *** *** your ****** ** ** *
* *** * *** ** * ***** * = getchar();
*** ** ** * ******** = **
****** * ***** * *** = getchar();
* * * *** *** * * ***** = getchar();
** **** * ** = ****
** * *** *** = **
* ******** * ** * = getchar();


* **** ** * * ** ****
*** * ******* *** **
* * * *** * * ** ** * **

** * ** ** * ***** ******* q >= 'a' * * * q <= 'z' )
** **** ** * * * * * * ** * * ** ** ** *** ****** * ***** ** * q + * * * - 'a'));
**** ** * * ** *** * * ******** **** ** * w >= 'a' * *** w <= 'z' )
* ** * * *** ** ** **** ** * ***** ** * *** * * ** * w + **** *** - 'a'));
* *** ** * ** * * * * * ** *** **** e >= 'a' * * * e <= 'z' )
*** * ** * * *** * * *** * ** * * **** *** ** *** * *** * * e + * * * - 'a'));
** ** *** * ** * *** * * * *** * **** r >= 'A' ***** ** r <= 'Z' )
** *** ** ***** * **** * * ** * *** **** * * * *** * * ** * ** r - * *** * - 'a'));
** *** ** * ** * ** * ** * * *** * ** t >= 'A' * * * t <= 'Z' )
*** * * ** * ** ** ** * **** ** * * * * ** * **** * * * ** t - * - 'a'));
* * ** * *** ***** **** **** * * ***** * * * y >= 'A' **** * * y <= 'Z' )
** * ****** * **** * ****** * *** ** * *** * ** * ** * * y - ** ** * - 'a'));
*** **** ****** ***** * ** * ** **** * u >= 'A' ** * ** u <= 'Z' )
* **** ** ** * * ** *** *** * * * **** * ** * ****** * ** u - ** * ** - 'a'));
** ** * * *** *** * * * * * * ** * * * *
* * **** *** * *

** * ***** **
* * ** * ** ** * 0;
}
100/100 answered by (153 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include * **** *** * *
** ** ** ** ***


/* run this program using the console pauser or add your own getch, * ** * *** * **** ** * * or input loop */

int main(int argc, char *argv[]) {
* * * * ** **** * char **** * *** // You can change these ** * **** it entirely depends on you.
* **** * * * * ** * * your *** *** * * // Do not change this// Your * * start from here

** * *** * * ** = * ***
* ***** * *** **** * * = * **
** * * * * = ****
** * * * *** * ** ** * = ***
* *** * ** * * ** * ******* = ***
**** * * * ** ** = * *
* **** * *** * ** *** ** = * * *
* * ** *** * ** *
* ** * * ** *** * * ** = * ** * **
** *** *** ** ** * ** * **** ** *
* * * **** ** * **** *
* ** * ** s2 = * ******
****** * * * * * * *** ** *
** ** **
**** ** s3 = *** *
* *** * **** * * ** ** * ** s3);
* * * *** *
* * * ** s4 = * **
* * * * * * * **** ******* , s4);
*** * * ****
* * * **** s5 = ** **
* *** * **** * * ** *** *** ** * * * * *
** * *
** *** * **** *** * * ***** * * s6 * * ****
* ** ** **** * ** ***** * * * *** ** s6);
** *** ** * **** * * * *
* * **** ***** ** = s7 **
* ** * * * ** **** ** * ********* * * s7);
* ** ** ** *** ** * *
* *
* * ** ** *** return 0;
}
100/100 answered by (283 points)
0 0
prog.c:3:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main(){
** ** ** * ****** * ** a[7];
* *** * **** * * **** ** * ** * your charaters:\n");
* * ******* ** ** ***** * ** * * * * * a);
    int i;
***** * * ** ********* * * * ***** ****** {
* * *** ** ** ***** * *** * *** * * ** **** * * **** {
** * * * ** ** * *** * ** * * * ** ****** ** * * * * *** ** *** * * ** ** * *** a[i]-32);
*** ** ** ***** * *** * ** * * * * * *
** * * ** * * ** * ****** ** * ** ** *** {
**** **** ** *** **** **** * ** * ** * * * **** *** *** * ** * ** * ** * * * *** ** a[i]+32);
* *** **** * ***** * ** ******* ** * ** * * ** ****
    }
}
100/100 answered by (273 points)
edited by
0 0
prog.c: In function 'main':
prog.c:7:13: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
     int i,N=strlen(a);
             ^~~~~~
prog.c:7:13: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:7:13: note: include '<string.h>' or provide a declaration of 'strlen'
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
prog.c: In function 'main':
prog.c:6:5: error: expected ')' at end of input
     scanf("%s", a
     ^~~~~
prog.c:6:5: error: expected declaration or statement at end of input
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include ** ***
#include * * *


int main(int argc, char *argv[]) {
* ** * * * ** * ** * **** a, b, c, d, e, f, g;
* * * ** ** *** * *** ** * *** your * * ** * **

** * * * *** * * ** * * **** ** ** *** *** ** ** ** * &b, &c, * * * * * * **
* **** * ** * * * * * *
* ***** * * * * * ** -= 32;
* ** ** ** **** -= 32;
** * * * ** *** ** * *** -= 32;
* ** *** * * * **** += 32;
** * ****** *** ** * *** += 32;
* **** * ** ** * += 32;
** ** *** * ** += 32;
***** *** * * * * *
* *** ***** ** * * ** * * **** * ** * * a, b, c, d, e, f, g);
* **** * *** ***** *
** * * **** **** * *** * 0;
}
100/100 answered by (290 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include **** ****
#include ***** *


int main(int argc, char *argv[]) {
* * * * * * * *** * * a, b, c, d, e, f, g;
* **** ** ** **** * * * ** your * * ** ***

** * ** **** *** * *** * * * *** ** ** * ** ** **** &b, &c, * ** * * ** **** * * * *** *
* * * ** * **** ****
* ** **** * *** ** * -= 32;
** *** * ** ** * *** -= 32;
* ** ** * *** ** ** * -= 32;
* * ** * * ** ** * * += 32;
* *** **** ****** * += 32;
* * ***** ** * * += 32;
* **** * * ** ** ** ** += 32;
*** **** * **** *
* * ***** * * ** * * ** * * ** * **** * * * ** * a, b, c, d, e, f, g);
** **** * **** *
*** * ** * * * * *** 0;
}
100/100 answered by (269 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
* ** *****
* ** ***** * ****


*** * * ** * ** ** {
***** * * ** a, b, c, d, e, f, g;
* * * * ** ** ***** * * ** ** * *

** *** *** ** ** *** * * ***** * ** ** * * * ** * * * ** * * * ** ** ** *
**** * * ***
* * * * a -= 32;
** * * ** * * b -= *
**** * * c -= 32;
* * ** * d +=
* * * ** e += *
* * * * * * f +=
** * * * * ** g +=
* * *
**** * * * *** * * * ** *** a, b, c, d, e, f,
* * ** *
** ** ** * *** * 0;
}
100/100 answered by (269 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
* *** ** ** * ***
* * ** ** *** * ***
*** * * * *
* ** * * * ****
int main(){
* * *   char ** *
** * * **** do{
******* * *** * * **** ****** * ** *
** *** * *** ** * ** ** ** * ** *** your ** * ** *** *
** *** *   * **** * * ** ** ** * ** ******** * ** *** ** *
* *** * * * * * *** *** * *
* ** ** *** *
** * *** * *** * ** : * * *
*** * ***   for(int * *
** ***       string[i] = ****** *
* * * ** * ** * * * * ** * *** **** * ** *** ***
*** }
** ** * *
* * ** ***** for(int *** **** ***
**** * *** * ** * * ** * * string[i] = ** ** *
** * *** ***** * * * **** * **** * **** * * ****
* * * *** * }
* *** ** **** **
* * * *****
* ** * *
** ** * ** return 0;
}

//INPUT
** *

//OUTPUT
* *
100/100 answered by (271 points)
0 0
prog.c: In function 'main':
prog.c:10:13: warning: format '%[^
   ' expects argument of type 'char *', but argument 2 has type 'char (*)[10]' [-Wformat=]
   scanf("%[^\n]",&string);fflush(stdin);
             ^
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.197.65
©2016-2026

Related questions

0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Oct 27, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 29618 - Available when: Unlimited - Due to: Unlimited
| 7k views
0 like 0 dislike
24 answers
[Exercise] Coding (C) - asked Nov 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 30241 - Available when: Unlimited - Due to: Unlimited
| 7.9k views
0 like 0 dislike
20 answers
[Exercise] Coding (C) - asked Nov 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 30222 - Available when: Unlimited - Due to: Unlimited
| 6.8k views
1 like 0 dislike
23 answers
[Exercise] Coding (C) - asked Oct 20, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 28130 - Available when: Unlimited - Due to: Unlimited
| 8.1k views
12,783 questions
183,442 answers
172,219 comments
4,824 users