0 like 0 dislike
8k views

Please write a program that receives 'A' then outputs 'A'-'Z'. However, if a vowel (A, E, I, O and U) appears, it will show '?' instead.

Example(template)

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

int main(int argc, char *argv[]) {
	char a;                      // can be changed
	printf("Enter your input:"); //DO NOT CHANGE
	scanf("%c",&a);
	
    // Your conditions start from here
	
	return 0;
}

 

Input

Enter your input:A

Output

Enter your input:A
?BCD?FGH?JKLMN?PQRST?VWXYZ

 

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

24 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
* * * ** ** **** *** a; * * ** * ** ** *** * *** **** * ** ** **** *** ** * * ******* *** * ** *** * * *** * ** * * *** ** * can be changed
** *** * * **** * ** ** *** your input:"); //DO NOT CHANGE
*** ** ** * *** ** * * * * *** ** *
    
** * * ** *** *** * Your conditions start from here
** * ** * ****** * = 'A'; a <= 'Z'; a++){
******* ** * ** * * * * * * * ** ** ** *
** * ** * ** * * * *** ** ** * **** * * *** * * *** * * a == 'A'||a=='E'||a=='I'||a=='O'||a=='U'){
* ** *** ***** * * **** * **** * * *** ** ** ** ** * * * * * *** * * *** ** * *** * ** * * *
*** ** * * * * ** ** *** **** *** * * *** ** *** * * **** * * * * * * *****
* ** **** *** * * ** **** *** * *** **** * ******** *** *** *** **** * * ** * * *
* * * ** *** ** ** ** ** **** * ****** * * **** ***** * **** a);
* * ***** ** * * * ** ** * *** ** *** *
*** ***** * ** * * * * ** * ******* *** * * ***** *
*** ** * * * ** * * * 0;
}
100/100 answered by (283 points)
edited by
0 0
prog.c: In function 'main':
prog.c:7:10: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'char *' [-Wformat=]
  scanf("%d",&c);
          ^
0 0
prog.c: In function 'main':
prog.c:12:11: warning: missing terminating ' character
  if ( a = '
           ^
prog.c:12:11: error: missing terminating ' character
prog.c:13:2: error: expected expression before '}' token
  }
  ^
prog.c:13:2: error: expected expression before '}' token
0 0
prog.c: In function 'main':
prog.c:10:15: error: expected ')' before ';' token
     if(a = 'A'; a <= 'Z'; a++){
               ^
0 0
prog.c: In function 'main':
prog.c:12:30: error: expected expression before '?' token
                printf("%c", &?);
                              ^
prog.c:16:30: error: expected expression before '?' token
                printf("%c", &?);
                              ^
prog.c:20:34: error: expected expression before '?' token
                    printf("%c", &?);
                                  ^
prog.c:24:36: error: expected expression before '?' token
                      printf("%c", &?);
                                    ^
prog.c:28:33: warning: missing terminating ' character
                      printf("%c"' &?);
                                 ^
prog.c:28:33: error: missing terminating ' character
                      printf("%c"' &?);
                                 ^~~~~~
prog.c:29:22: error: expected ')' before '}' token
                      }
                      ^
prog.c:28:31: warning: format '%c' expects a matching 'int' argument [-Wformat=]
                      printf("%c"' &?);
                               ^
prog.c:29:22: error: expected ';' before '}' token
                      }
                      ^
prog.c:34:1: error: expected declaration or statement at end of input
 }
 ^
prog.c:34:1: error: expected declaration or statement at end of input
prog.c:34:1: error: expected declaration or statement at end of input
prog.c:34:1: error: expected declaration or statement at end of input
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

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

* * * ** * * ** a;
* ** * *** *
** * *** ** ** * ** * * ***** * *** * &a);
*** * ** ** * * **
* * *** **** ** ** * * <= 'Z')
**** **** * ** **
**** *** * * * * * *** * ** * * *** == 'A'|| a == 'E' || a=='I' || a=='O'|| a=='U')
* *** *** **** * **** *** ** ** ****** * * ** * **** * ** ***** * * *** ***
* * **** * * *** ***** * ** ***** *****
** * * * ** ** * **** ** * *** * * * * * **** **** * ** *** * ** ** * * * ** * * *** *** * * a);
* * * ** ** ** * ** * ** * * * * ** ***** *
* ****** ** ** ** *

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

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

**** ** * char a;
* * *
*** *** * * ** *** * * ***** * * **
* * * ** * *
* ** ** while(a <= 'Z')
* ** * ****** * ****
* * ****** * ** * *** * **** if(a == 'A'|| a == 'E')
*** ** * * * ** ** * * * * * *** *** * ********* * * ** **
****** **** * * * ***** * ** ** else
* * * * ******* * * * * *** ** * * * * ** *** *** *** * * a);
* **** ** * *** * * * ***** * ** ** a++;
***** ** }

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

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

* * ** char a;
* * * * *
**** **** ** * ** ** * *** *** *** ** **
* * * ***
* ** * ** * while(a <= 'Z')
* * * * * * ** *
* * * ** ** ** * ****** ** * * * if(a == 'A'|| a == 'E')
** * ***** * * *** ** ** **** * * * ******* **** ** ***
*** ** * * *** **** *** * **** else
**** * * ***** *** *** * *** * ******* *** * * **** * * ** ** * * * ** * * a);
******* * ** **** ** *** ** * * **** a++;
* * * ** }

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

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

* *** * * ** char a;
* * * *****
** * * ** * *** * ** ** a);
** * * *
** * ***** ** while(a <= 'Z')
*** * *** *** * ** * * ** *
* *** * **** ******* * ** *** if(a == 'A'|| a == 'E')
* * *** *** * * * * ** **** * ** * * * *** ** ** ** * *** *** **
* ** * * * ** * ** *** else
******** * ** * * *** * * * * * ** ***** * *** * ******* *** *** * * ** a);
** ** ** ***** * ** * ** * ** * a++;
** ** *** }

* ** ******* return 0;
}
answered by (153 points)
reshown by
0 0
prog.c: In function 'main':
prog.c:8:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=]
  scanf("%c", a);
          ^
0 like 0 dislike
Hidden content!
#include ** * * * *
#include * ** *** **

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

* ** * * *** int a;
*** * ****
* ** *** * ** * * * * ** ** * *
**** *
* * * ** * while(a <= 'Z')
** * ** * *** * ** *
* ** *** ************ *** ** *** * * ** if(a == 'A'|| a == 'E')
**** * *** ** * * *** * * * * ***** ** * **** ****** ** ** ** * * *
** ** * * * * **** ** * * else
* * * ** ** * * * ** * *** ** * **** ** **** * **** **** ** * a);
* *** **** * ***** *** *** ** a++;
*** * }

* ** * *** return 0;
}
answered by (153 points)
reshown by
0 0
prog.c: In function 'main':
prog.c:8:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
  scanf("%c",&a);
          ^
0 like 0 dislike
Hidden content!
#include ** * * ******* *
***** ** ** *

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

* * * * ** * int a;
** * * **
* ** * * * ** * * * *** a);
* * * ****
* * * * while(a <= 'Z')
* *** ** ** ** **
** ** * *** * * * *** * * * ** if(a == 'A'|| a == 'E')
** * **** * *** * * * ** ***** ** * **** *** * ** * *** ***** *** * *** *
** ** ** * * * ******** *** * ** else
** * * * * *** **** ** * *** * * ** ** * * * * * * *** ** * a);
**** * ****** *** ** * ** ** ** * a++;
* ** * **** * }

* * * ** return 0;
}
answered by (153 points)
reshown by
0 0
prog.c: In function 'main':
prog.c:8:10: warning: format '%c' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=]
  scanf("%c", a);
          ^
0 like 0 dislike
Hidden content!
* *** * *** * **
*** *** * ** * * *

int * argc, char {
* * char a;
** *** * *** * *
* ***** * *** ***** *** ** your * ** *
* * * * * * *** * * ** * * * *
*** ** * * ** **
* *** ******* **** * ** ** * ** * * **
*** *** * ****** ** ** * ***** if(a == 'A' || a == 'E' || a == 'I' || a == 'O' || a == 'U')
** * ***** * ** ** * ** ** * * ** ***** *** * *
*** **** ** ** * else
******* *** * * *** * * **** ** ** ** ************ ** ** * * a);
** ** ** ***** * **** * a++;
** ** * ** }
**** * *
**** * ** ** return 0;
}
100/100 answered by (269 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main(){
    char a;
* ** ** * ** * ** *** ***** your input:");
* *** * *** ******* * **** **** **** * ** &a);
* * * ** *** * * ******* * * * ** ** * {
* * *** ** *** ** * *** *** **** * ** *** * ***** ** {
** * * ** ** ** * *** **** ***** * * *** * * * * ** * * ** * *** ** * ** * **** **
* *** * **** * * ** ** ** * **** * **** **********
* * * **** ** * * ** **** * **** * * {
* *** *** * * ** * * ** * * * ****** * ** * * * ** * * * * * * ***** * a);
** * *** ** *** *** ** ** *** ** ***** * ***
    }
}
100/100 answered by (273 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<stdlib.h>
int main(){
int i;
*** ** * * *** a;
* ** *** ** * ** * *** ** * ***** * your input: ");
*** * * ****** * * * * *** **** &a);fflush(stdin);
** *** * * * * * * * * * *
***** * *** * * * ** *** **** ** ** * * ****
*** * * ** * **** * * ** * * * ** ** * * *** * ** * * *** * * * * * * ||i==69 || i==73 || i==79 ||i==85){
*** * * ** * * ** * *** * ** * * * * * * ** * * ** ** *** ***** ****** ** * *** ** * *** **
***** * * * ** **** ** * ** **** * ** ** * * * ** * * * ** *****
* * * ** * * * *** *** ** * *** * * * ** * * * ** ** *****
** ** * * ** ** *** *** ** ** **** ** * ** * *** ** **** * ***** * * ** * * ** * ** *** * *** *
*** * * * ***** * **** ** ** * * ** **** ** *** * * ****** ****
** * * **** ** ** ** ** ***** * * ** * **
* * * * * * * * * ***
}

//INPUT
//Enter your input: A

//OUTPUT
//Enter your input: A
//?BCD?FGH?JKLMN?PQRST?VWXYZ
100/100 answered by (290 points)
reshown by
0 0
Case 0: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.197.94
©2016-2026

Related questions

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.4k 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
| 7k views
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
| 7.1k views
0 like 0 dislike
14 answers
[Exercise] Essay (Open question) - asked Nov 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 30244 - Available when: Unlimited - Due to: Unlimited
| 3.8k views
12,783 questions
183,442 answers
172,219 comments
4,824 users