0 like 0 dislike
2k views

Use the pointers p1, p2, and p3 as a first number, the second number and the sum respectively and complete the following program to read two integers and display the sum of the integers between them. For example, if the user enters 6 and 10, the program should display 24 (7+8+9). The program should force the user to enter numbers less than 100 (<100) or greater than 0 (>0) and the first integer should be less than the second, else display "Invalid value".

Sample code:

#include <stdio.h>
int main(void){
    int *p1,*p2,*p3,i,j,sum;
    p1 = &i;
    p2 = &j;
    p3 = &sum;
    //Your code


    return 0;
}


Sample Input 1:

6 10

Sample Output 1:

24 (7+8+9)

Sample Input 2:

10 6

Sample Output 2:

Invalid value

 

[Exercise] Coding (C) - asked in Chapter 12: Pointers and Arrays
ID: 38252 - Available when: Unlimited - Due to: Unlimited

edited by | 2k views

58 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
int main(void)
{
**** * ** ** * * * ** ** *p1,*p2,*p3,i,j,sum;
    p1 = &i;
** * ** **** * ** * ** = &j;
*** * ** * ** * * * = &sum;

*** ***** * *** * * * a;
***** ****** *** ***
* ********** * * ** ** ****** %d",&i,&j);

******* * *** * ** * * * *** && i>0 && j<100)
    {
** ** *** *** *********** * ** *** ** ***** **** **** ** * * *
* ******** *** ** * * *** ** * * * * ** *
* * * ** ***** ** ****** * * * * * ** *** ***** ***** *** * **** * * *
* ** *** *** ** ** **** ** ** ** * * **
*** ******* ** * * ** * *** ** * * * ** *** ** *** * * *p3);
* *** ***** * * * * * * * * ** *** * ** * *** * ** ** **
** * * ** * *** * * ** * * ** * * ** **
** *** ** ** * ** * *** ***** * * ** ***** ***** * * * * ** ***** * ** * * * *
* * * *** *** ****** * ** ***** ***** * ** ** ** ** * * ***
* * * * * ** * * * *** ** *** *** **** **** *** * * *** * ** * ** ** * **** * ** ** * * **** (%d",*p1+1);
** ** * ** * * * ** * ********* ****** * * * * ****** *
* * * **** ** ** ** *** * ** ** *** * * ******* * *** ****** * ** * **** ** * ****** * *
* ** * * * ** ***** * ** * *** *
***** ***** * ** * * **** * * * ** ******** * * * ** ***** * ** **
    }
** * *** * * * ** * ****
    {
** * *** ***** * * * * *** * * *** ** * * * * **** ** value");
    }

* * ** ** * ** * 0;
}
answered by (-140 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h> * ****** *** *** * * * *** * * ** ** ******* ** ** * **** *** * * * * * * * ** * * *** * * * * * * * *** ** **** *** * ** * ***** * ** * ****** * ***** ** * * * ** ** * *** ** ** *** * * * * * * ** * * ** *** * ***** *** **** ** * * ** * *** ** *** *** ****** * * *** ** * ** * * **** * * *** * * *** * * * * * * * * * ** ***** *** ** *** ** * * **** * ** * **** ** ** * * * ***** * * *** ** * * * **** *** ***** ***** *** *** * * ** * ***** *** * ** * * ** ** * * **** **** * ******* **** *** ** ** ** *** ** **** **** *** **** ** * ** * ** * **** **** ** * ** ** * * * ** * * * *** * * * * * * ***** * * ** * * **** * * ***** * ** * * * * ** ** * ** * *** * * ** * ** *** * ** ***** ** * * ******* * ** ** * * ******* ** * ** ** * ** * ** ** * * *** *** * * * * * ** * **** * ** *** * * * *** * * * * * * ******** ** * ** * *** * ** * ** * * * * * *** * ** ** * * * *** ** **** *** * * ** ** * ** * ** * **** *** ** * **** ** ****** ***** * * *** *** *** * * * *** *** * ** ***** ** * * * *** * * * * * ** * * *** ***** * ** ** ***** * ** ** ** * **** * ******** * ***** * * * ****** * ** * * ** * ** **** * * ** ** *** ** ** ** *** * ** * **** **** * * ************ * *** * * * * * * ** ** * * * * ** * * ** * ** *** **** * ***** * * * * ** * ** *** * *** * ** * ** *** ***** ** * * ** * * * * * *** ** ** * * ****** * ** * ** * * ** ***** * ** * * * * *** * * * * **** ** ** * * ** * * * * * * ** **** * * ** * * * * *** *** * **** ** * * * *** *********** * * ** ** ** * *** * ** ** * * * ***** * **** ** **** *** ** *** * ** * * ** ** * * ** **** ** * * * **** ** ** ** ** * ** * * * * ******* *** * ** *** *** * * **** * ** * ***** * ** *** *** ** * ** ***** * ** ***** *** **** * ** ** **** * ** ******* * ** *** * * ** * ** *** * * * * *** *** * * ** *** **** * * ** **** * * * * *** * ********* * * * * ** ** **** * **** *** ** *** * * * ** ** **** * * * * ** ** *** * * ** * ***** * ** * * * * ** * * * *** ** * * * ********** **** * **** *** ** * *** ** *** * ** **** * * ** * **** * * * * * ** * ***** ** ** * * ** * ******* ** ** ** ** * ** *** ** * ** * * * * * * ********* ** ** **** *** *** **** *** *** * ** ****** ** * *** * * ***** **** * ** ** * * * * * * * *** ** ***** ** * Elvis Suazo

int main(void){
    int *p1,*p2,*p3,i,j,sum;
    p1 = &i;
    p2 = &j;
    p3 = &sum;
    //Your code
    scanf("%d %d",&i,&j);
    p1 = &i;
    p2 = &j;
    p3 = &sum;


*** * * ** * * ** * * ** * * * * * * * * **** ** * ** ** **
** * **** *** ** ******** *** * ** * * * ** * ** value");
** *** * * * ******** ** * * * * * *** * ** 0;
    }

    sum=0;
** ** * ** **** * * * * * *** * **
* **** * *** ** * *** ** *** * ******* ** *
    }

    printf("%d (",sum);

    for(*p2=*p2-1;sum>0;j--){
* ** * * ** * * * *** ** * ** * * *** ***
    }


    for(j=j+1;j<i;j++){
* ** **** * * * **** * **** * * * * * *** ***
**** ** ** * * * ** ******** * * ** * *** ** * * ****
* * ** * * ****** * **** * ****** * ** (j<i-1){printf("+");}
    }
    printf(")");


    return 0;
}
answered by (-286 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h> * * * * * * *** *** * * * ** * ***** * ** *** ** **** *** * ** * **** ** * * * * ** ** *** *** * *** * * * * * * * ** * ** * ****** * ***** * * *** **** * ** ** *** * * *** **** ** *** * *** * * ** * ** * ** *** * * * * ** * ** * **** * * ** * ** * * ** * ** * ** * ** * * **** **** ** * ** * ** * * *** * * ** ****** * ** * * ****** * * * *** * ***** *** ** ** *** * **** * ******** * * ** * * *** * * * * ***** ** * *** ** * *** * ** * * ** ** *** ** ** * ** * * * *** * ** *** ** * * * * **** *** ** * ***** *** **** ** **** * **** * * *** ** ** ***** * ** * * *** * * * * ** * *** * ** * * * ** ** * *** *** * * ** * ** * ***** * * * ***** * * *** **** ** *** **** * ** ***** ** ** **** ******* ** * *** * ** **** * *** * * **** * * * * ** *** * * * * **** * * ** * * ** ****** *** *** **** ** ** ** *** * * **** ******* * * * **** ** * ** ******* ** * ** * * ** *** ** * ******** * * * ** ** *** ** * ** * * ** * * * ** *** * * * * ** ** * ** * ** ** *** * ** * * **** *** * ** ** * * * *** ** *** ** * ** ** * ******* *** * * *** * * ** * *** * * * * ** *** ***** ** * * *** ***** * ** ** *** ** * **** ** ** *** * *** * ** * *** * * ***** ** * ******* **** **** *** * * *** * * * ***** * *** * * * * * ***** * **** ******* * * * * * *** ** * * * * ** * * ** * ******** ** ** * *** * ******* **** * ** * ** ** ** *** * ******* ** * * * * * ******* * * * ** ** ******** * ***** * *** * ** * * * * * ** * ** * * * ** *** * *** ** ** * *** * * ****** * ** ** * ** ** ** ** * *** *** * *** * *** * * * ** ** * * * ***** * * * * ** * * **** **** ** * * * ** * * ** ** * ***** ** **** *** ** * * * ** ** * * **** * ****** * * * *** ** * ** * ** ** * * * *** ***** * * * * * * *** **** ** * *** ** ************* **** * * * * *** * ******* * * ****** ** * *** ** * * * *** * **** * *** * * ** * ***** * *** * * ** * ***** *** ******** ** ** * ** ** * ** * * ** * * * ** *** ***** ** **** * ** * ***** * ** **** *** ** * * * * *** ** * ****** * * * *** * * * * ** * ** **** * ** ** ******* ***** * * ** * * * *** * * * * ** * * ** * ** * ** * ******* ** **** *** * * ** * ** * * * ** * **** ** ** ***** * * * * **** * * *** ****** ** * * ***** ** * * * * ** *** ** * * * * Elvis Suazo

int main(void){
    int *p1,*p2,*p3,i,j,sum;
    p1 = &i;
    p2 = &j;
    p3 = &sum;
    //Your code
    scanf("%d %d",&i,&j);
    p1 = &i;
    p2 = &j;
    p3 = &sum;

    sum=0;
* * * ** * * ** **** ** ** ** * * * ** **
* * * * * ** ** ** * *** * * ** ** * ** **** **
    }

    printf("%d (",sum);

    for(*p2=*p2-1;sum>0;j--){
** * **** ** ******* ** * * **** ***** ** ****** * ***
    }


    for(j=j+1;j<i;j++){
**** ** ** ******** * * * * *** ***** * * * **** ***
* *** ** ** *** * * * * ** * *** * * * ** * * * *
****** * ** ** * *** * ***** ****** * ** ** * (j<i-1){printf("+");}
    }

    printf(")");
    return 0;
}
answered by (-286 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h> **** *** **** ** * * *** * ** * *** ***** ** ** *** ** ******* *** * * * *** * * *** * * * *** * * *** * * ** * *** * ** *** * ** * * * * ** * ** ***** ** * ****** * * **** ** * ** ** * ***** * ** ** ** ** ** * * ** ** * * ** * * * * * ** * ** ******* * ** * ** * * * ** *** * * ** ** *** * * ** ** *** * *** * ** ** ** * * * ** *** ** * *** ** *** * * *** * ****** ** * * *** * *** **** **** * *** * ** * * * * * ** **** ** * * ** ****** ** ** * * * * * ***** * **** **** ******* * * *** * * ******* * ** * * *** * * ** *** * * * ** * *** ** * ***** ** ** *** ****** * ** ** ****** ** ** * * ** * ** ** * ** ** * **** **** * * *** * * * *** **** *** *** * ** * ** * ** * * * * **** ** * ** * * ** ********* * ** * * ** * *** * ***** ** ******* ** * * * * * ***** * ***** * * ****** * * * * ******* * * * ******* * ** ** * * **** ** ***** * * * * * * * * * ** * * **** **** ** * * * * ** * ** * ** ** * * * **** *** **** * * ** * ** * * *** ** *** * * *** ** * *** ** ***** * ** ** * * * * * * ** * * *** *** * * ** ** * ** * ** * ** ** * *** * *** * **** ** * * ** **** * ** * * ** * ** ** ** *** ** * ****** * * * ** * ****** * * * * * * ****** **** ** * *** * *** ** **** ***** ***** *** ***** ** ********* * * * ** * * *** * * * *** ***** * *** *** ** ******* * * * * **** * ** * ** *** * * ** *** * **** * **** * * *** ***** * * * *** * *** ***** * * * *** ** * *** *** * ** * ** * ** * * ** ** ** * ** **** * **** * * ** **** * ** * * * * *** ** * * * * * * * *** ** ** * * **** ** **** ** * * *** ** **** *** *** * * ** * ** * ** * **** ** * * ****** ***** * * * ** ** * ** * ** * * * * ** * ***** *** * * ** ** * **** * * * *** ** * ** ** * * * ****** ** **** ** * ** ******** *** * **** ** * * ** ******** ** ** ******* * * ***** *** * * ********* ** *** *** * *** *** * *** * *** * *** **** ** *** * * * * * * ** ****** *** ** * * * *** * * ** *** * * *** * *** * * **** * **** **** *** * **** * * * * * * * * ** * ** * *** ***** *** *** * *** * *** *** ** * ** * ** ****** *** * * *** * ** ** ** *** * * ** ** * * * * * ** * ** *** ** **** ****** ** ** * * * * * * * ***** * *** * ** ** * ***** *** * ** *** * *** *** * **** * * *** **** * **** * * ** * *** * * * ** * * ** ** * * * ***** * ********** ** ** * * Elvis Suazo

int main(void){
    int *p1,*p2,*p3,i,j,sum;
    p1 = &i;
    p2 = &j;
    p3 = ∑
    //Your code
    scanf("%d %d",&i,&j);
    p1 = &i;
    p2 = &j;
    p3 = ∑

    sum=0;
    for(i=i+1;i<j;i++){
** * ** * ** *** ****** ** * * * * * *** * *
    }


    printf("%d (",sum);


    for(j=j-1;sum>0;j--){
*** *** * ** ** * ** * ** ** * * ***** * *
    }


    for(j=j+1;j<i;j++){
*** ** ******* * * ** * * * * * * * * * ** *
* ** * * ** * * * * ** **** * * *** **** * * ***
** * * * ** *** * ** **** **** ** * * ** ***** * * (j<i-1){printf("+");}
    }

* * * ****** ** *** *** * * ** *****
    return 0;
}
answered by (-286 points)
0 0
prog.c: In function 'main':
prog.c:7:10: error: stray '\342' in program
     p3 = \xe2\x88\x91
          ^
prog.c:7:11: error: stray '\210' in program
     p3 = \xe2\x88\x91
           ^
prog.c:7:12: error: stray '\221' in program
     p3 = \xe2\x88\x91
            ^
prog.c:7:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     p3 = \xe2\x88\x91
        ^
prog.c:12:10: error: stray '\342' in program
     p3 = \xe2\x88\x91
          ^
prog.c:12:11: error: stray '\210' in program
     p3 = \xe2\x88\x91
           ^
prog.c:12:12: error: stray '\221' in program
     p3 = \xe2\x88\x91
            ^
prog.c:12:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     p3 = \xe2\x88\x91
        ^
prog.c:34:12: warning: too many arguments for format [-Wformat-extra-args]
     printf(")",sum);
            ^~~
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main(void)
{
** * ** ** *** ** **** * * * *p1,*p2,*p3,i,j,sum;
****** ** * ********* *** = &i;
* ** ** ** * * = &j;
* * * ** ****** * = &sum;
    
** ** **** * * * * * * * a;
** * ** * **** *** *** *****
* ** * ****** * * * * **** * %d",&i,&j);
    
** * ** * ** *** * *** * && i>0 && j<100)
    {
* *** ** ** * ** ** * **** * * * * * ** ** * * **** *** *****
***** *** * * * * * * * ** * * * *
* ** ** ******* **** * * * *** * *** * * * ** ****
* ** ** * *** * * * ** * ** *** * * *
* ** * ** **** ** **** * * ** * * * * * * *p3);
** **** * * *** * * **** *** * * ** ** ** * **** ** * ** *** *
* **** ** ** * * * *** * *** **** * **** * *
* * * * ** * *** ** * * *** *** ** * * * * ** ** * ** *** **
***** * ****** *** * * ** ** * * * * *** * ******** * * *****
* ** * * * * *** ** **** * * *** ** ** ** ** * * ** * * ***** * * * *** * * *** (%d",*p1+1);
***** * * * * * * ** ***** *** * * *** * * * * **** * ** * * * * ** * *
* **** * * ** ********* * **** *** *** * ** * * * *** ** * * * * *** * ** * ****
*** * *** ** * * ***** * ** * ** * *
* * *** * **** * * * * * * ** *** ***** ****** * * * * ** *
    }
* ** **** ** * **** ** **
    {
** *** *** * ***** ***** ** *** ** ** ** * * *** ****** * * * value");
****** *** ***** *

* ** ** **** * * * * ** 0;
}
answered by (-167 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include * * ** * * *
int ****
{
***** * ** **** int * * ** * *
** * *** **** * ** ** = ***
**** ** *** * * * * *** = ** * * *
* ** ** * * **** * **** = * * *
*** ** ** ** *** * ** * ** * *** * * ** ***

*** ** * * int c = 0;

* ** ** * **** sum = 0;

** * * if(i >= j)
* ** ** * {
* * * * * ** * * ** ****** *** ***** * * **
* * ** * ** }
** * ***** else if(i < 0 || j > 100)
**** *** ** {
* * ** * ** ** ** * * * *** * ** ** ** * * *
* * ** * *** }
* * * * else
*** * * * {
* * ** * * **** * for(c = i + 1; c < j; c++)
*** * ** * * ** ** * {
** * **** * *** *** * * * * ** * sum += c;
***** ** * * * ***** ****** }

* * * * *** ** * * ** * * *p3);

* * * * ** * ** ** for(c = i + 1; c < j; c++)
* *** * ** * * ** ** ** {
*** * * ** * * * * ** * * * ** * * if(c == j - 1)
** **   ** * * ** * * * * *** * {
**** * * * * **** * ** * * * * *** * * ** * * **** * ** c);

* * ** ** * ** * * * * * * * ***** * break;
* ** ** *** * * * * ******* ** }
* *** * ** * ** *** ** * * * * ** ** else
* ** ** *** *** * *** * * *** {
** ** ** * ** ** * * * *** * * * * * * *** * *** * c);
** * * *** *   * * * * * ** * * }
* * * * * * * * * ** }
** * * ** * }

* * ** ** * * * * * * * 0;
}
answered by (-285 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include * ** * * ** ** *
int ** ** *
{
* * **** int ** *** *
*** * ** **** * ** = **
* * * * * * * ** = * * * *
***** * * *** * * = **** *
*** * *** * ** ** * * *** **** * ***** *** ****

* ** * ** * int c = 0;

* **** *** * sum = 0;

* ** * * if(i * * *** j)
*** * ** ** * {
** ** * * ** ** ** ** * ** * * ** ***
* * *** ** }
*** ** * else if(i < 0 || j > 100)
** ***** *** {
* * * * **** * ** ****** ***** * * * * * * *
*** ** *** ** }
** * *** * else
** * * ** *** {
** * * * * ** ** **** for(c = i + 1; c < j; c++)
*** * * ** * ** ***** **** * ** {
**** ** *** *** ** * * * * ** * ** ** sum += c;
* * * *** ** * * *** }
*** * *** }

* * * * ** * * *** *** * *p3);
*** * * ** **** ** ** 0;
}
answered by (-285 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main(void){
* **** ** ***** * ** * *p1,*p2,*p3,i,j,sum;
    p1 = &i;
* * ** * * * **** *** * **** = &j;
**** ** * * *** ** * * = &sum;

** ** ** ****** ** * * **** %d",&i,&j);

** * ** ** ** * ** * *** (*p1<*p2 && *p1>0 && *p2<100)
    {
*** ** * * * ** * *** ** ** * ** * k;
** * ** ** ** ***** * * * * * * * * * **** *** * ** *
* * * ***** * * *** ******* ** * * *** ** ****** a[k];
***** * * ** *** ** ** ***** * *** * * *** * * ********

*** * * * * * * * ** ***** ** ** * * *** ** * b=0;
*** * * * * *** * * ** ** * * * *** * * * *
* * * * * * * **** ***** * * ** **** *** *
**** ** * * **** ** * * * ** * ** * * * * * *** * ***** *** * * * * **
** * ** **** * * ** ** ** * * *** ** ** * ** *** * * * ***** * * ****
** * * **** * ** ** * * * ** * *** *** * ** *

*** * * ** ** *** *** * ** * * ** **** ** *** * ******
* * * *** * ** ****** * *** ** ** * **** * *** * * *** (%d",a[0]);
* **** ** ** * * * ** ***** * *** *** ** ** c=1;
* * * ******* * * * * * *** ***** * **** * **** ** * *
****** ** * * ***** * ** * *** ** * ** * ** ** ***** ** * ** *** ** ** *
**** * *** ** *** ** ** * ** *** * * * *** ** * *
    }

* * ** * * * *
** * * * ** ** * * *** ** * **** value");


* *** * * * ** * *** *** * 0;
}
answered by (-16 points)
edited by
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 0
prog.c: In function 'main':
prog.c:6:10: error: stray '\342' in program
     p3 = \xe2\x88\x91
          ^
prog.c:6:11: error: stray '\210' in program
     p3 = \xe2\x88\x91
           ^
prog.c:6:12: error: stray '\221' in program
     p3 = \xe2\x88\x91
            ^
prog.c:6:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     p3 = \xe2\x88\x91
        ^
0 0
prog.c: In function 'main':
prog.c:6:10: error: stray '\342' in program
     p3 = \xe2\x88\x91
          ^
prog.c:6:11: error: stray '\210' in program
     p3 = \xe2\x88\x91
           ^
prog.c:6:12: error: stray '\221' in program
     p3 = \xe2\x88\x91
            ^
prog.c:6:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     p3 = \xe2\x88\x91
        ^
0 0
prog.c: In function 'main':
prog.c:6:10: error: stray '\342' in program
     p3 = \xe2\x88\x91
          ^
prog.c:6:11: error: stray '\210' in program
     p3 = \xe2\x88\x91
           ^
prog.c:6:12: error: stray '\221' in program
     p3 = \xe2\x88\x91
            ^
prog.c:6:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     p3 = \xe2\x88\x91
        ^
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main(void){
    int *p1,*p2,*p3,i,j,sum,a,b=0;
    p1 = &i;
    p2 = &j;
    p3 = &sum;
* *** ** ** * * * *** code
****** *** **** * * ** *** * ** *** %d",&i,&j);
* *** * * **** * *** ***
* *** *** ***** **** * * ** ** ***
*** * ** ** * ***** * * *** ** * * * * ** ***** ** * * * ** ** ** ** * *** **
***** * ** * ** * * **** **** ** * *** *** * ** ** **** **** *** * ** ** ****
* * * *** * **** * ** * * * * ** * * ** *** * * * **** * ***
* ** * ****** * ** **** *** ** * ** ****** * *** * ** ** **** ** * * ",sum);
** * ** * ** * *** ** ** ** * * *** *** * * *** * * *** ** ** **
**** * * * * * ** * ** *** ** * ** ** * ***
**** ***** * * *** *** ** * ** ** ** * **** * * *
*** ** * * * * * * * ** *** * * **** * ** * *** * *** * ***
* * **** * * ** * * * * **** * * * **** ** *** ** * * ** * ***** * *** *** * **** *** ** ***** ** * *
* **** * * ** * * **** * ** * * ** ** *** * * * *** **** * ** * ** *** * * ** *** ** * ** * *
******** * *** ** ** * ** * ** *** ** *** ** * *** ** *

** **** ***** * * * ***** *** *** * ** * * ** * * * * * * ** * ***** ** ** *
    }
    else
******** ***** ** * * * * *** ** * * * * *** * * *** value");
* *** ** * * * * *** * * 0;
}
answered by (-32 points)
0 0
prog.c: In function 'main':
prog.c:6:10: error: stray '\342' in program
     p3 = \xe2\x88\x91
          ^
prog.c:6:11: error: stray '\210' in program
     p3 = \xe2\x88\x91
           ^
prog.c:6:12: error: stray '\221' in program
     p3 = \xe2\x88\x91
            ^
prog.c:6:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     p3 = \xe2\x88\x91
        ^
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 0
prog.c: In function 'main':
prog.c:6:10: error: stray '\342' in program
     p3 = \xe2\x88\x91
          ^
prog.c:6:11: error: stray '\210' in program
     p3 = \xe2\x88\x91
           ^
prog.c:6:12: error: stray '\221' in program
     p3 = \xe2\x88\x91
            ^
prog.c:6:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     p3 = \xe2\x88\x91
        ^
0 0
prog.c: In function 'main':
prog.c:6:10: error: stray '\342' in program
     p3 = \xe2\x88\x91
          ^
prog.c:6:11: error: stray '\210' in program
     p3 = \xe2\x88\x91
           ^
prog.c:6:12: error: stray '\221' in program
     p3 = \xe2\x88\x91
            ^
prog.c:6:8: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     p3 = \xe2\x88\x91
        ^
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int *p1,*p2,*p3,i,j,c,sum=0;
* * * ** * ***** * * * ***** ** ** * ** ** ** **
* * * * *** ***** * * * ** * *
* * *** ** **** * ** ** ** * ***** *
* ** *** * * ** **** ** * * *** ****
* * * **** * ** *** ** * ** ** * * * ** * ****** *
* ** *** * ***** * * ** * ******* ** * ** *** * * *** **** * * * value");
    else if(j-i==2)
* **** * * ****** * **** * * * * * **** *** * * *** (%d)",*p1+1,*p1+1);
    else
    {
*** * * * * * ** *** * *** * * ** ** ** * ** * * ** **** * *
*** * * ** ** * * ** **** * * ** ** * ***** ** ** * * *** *** *
** ***** * * * ****** ******** *** *** * *** * * * ",*p3);
* ** **** ** * * * **** * * *** * * * * * ** **
******* ** *** * *** * ** * * ** * ** * * ** *** ***** **
* * *** ** * * ****** * * ** * *** * ** *** ***** * * * *** **** * ***** * *** ** * **
** * ** * ***** ** * ***** ** * ** * * *** * ** * * **** * ** * * * ** * * ** * *** * ** ****** *
** * * ** ** * * ** * ** * * *** ** * ***** ** ** *** **** * *** *** **** *
*** ** * ** * * ** ** *** ** *** * *** ** ***** *** * * * *** * ********** *** *** ** ** *** *** ** ** **
*** * **** ** * ** ** ** ** * * * *** ** ** *
*** ** ** * * ** ** * ** * * ** * * * ** ** * ** * **
    }
    return 0;
}
answered by (-304 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.71.254.132
©2016-2024

Related questions

0 like 0 dislike
58 answers
[Exercise] Coding (C) - asked Dec 21, 2017 in Chapter 12: Pointers and Arrays
ID: 38251 - Available when: Unlimited - Due to: Unlimited
| 2.3k views
12,783 questions
183,443 answers
172,219 comments
4,824 users