Skip to content

Instantly share code, notes, and snippets.

@microhobby
Created May 28, 2019 07:06
Show Gist options
  • Save microhobby/9f7207fcabe5bb094d5ac25ff45de6b1 to your computer and use it in GitHub Desktop.
Save microhobby/9f7207fcabe5bb094d5ac25ff45de6b1 to your computer and use it in GitHub Desktop.
/*
Elaborar um programa que leia dois valores inteiros (A e B). Em seguida fac¸a uma func¸ao˜
que retorne a soma do dobro dos dois numeros lidos. A func¸ ´ ao dever ˜ a armazenar o dobro ´
de A na propria vari ´ avel A e o dobro de B na pr ´ opria vari ´ avel B.
*/
#include<stdio.h>
#include<stdlib.h>
int *a,*b,*S;
int A,B,soma;
//funcao de calculo
int calculo(int **x, int **y) {
int dx,dy;
S = &soma;
dx = (**x) * 2;
dy = (**y) * 2;
*S = dx + dy;
**x = dx;
**y = dy;
}
int main() {
a = &A;
b = &B;
printf("\n*** [ PROGRAMA Num 6] ***\n");
printf("-----------------------\n\n");
printf("Digite A: ");
/*fflush(stdin);
scanf("%d",a);*/
printf("\nDigite B: ");
/*fflush(stdin);
scanf("%d",b);
fflush(stdin);*/
*a = 10;
*b = 10;
calculo(&a, &b);
printf("\nSoma do dobro de A +B: %d",*S);
printf("\nDobro de A: %d", *a);
printf("\nDobro de B: %d", *b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment