Questions tagged as 'c'

1
answer

Is table test result not the same as compiled?

The code below when executed returns the result for m = 0 , but doing the table test the result should be -2 . I can not prove 0 as a result unless the variable t++ when in (t * t++) , only this moment and only...
asked by 05.10.2018 / 06:04
1
answer

Implement numeric sum only with successor and predecessor

Consider a number system that does not have the addition operation implemented and that you have only the operators (functions) successor and predecessor. Then one is asked to write a function recursive that computes the sum of two numbers x and...
asked by 24.04.2018 / 01:58
1
answer

Programming in C using CodeBlocks giving error in programming below [closed]

#include <stdio.h> #include <stdlib.h> int main() { float num1 = 10; float num2 = 20; int resposta; num1 < num2 ? printf("Sim/n") : printf("Nao/n"); num1 < num2 ? resposta = 10 : resposta = -10; prin...
asked by 17.03.2018 / 00:14
2
answers

Convert add and remove functions in the tree to recursive

I'm having trouble converting two tree functions in C to the recursive form. int insere_arvore(ArvBin* raiz, int valor){ if(raiz == NULL) return 0; NO* novo; novo = (NO*) malloc(sizeof(NO)); if(novo == NULL) return 0; novo->info = v...
asked by 25.06.2018 / 15:15
1
answer

Algorithm to generate a diamond of characters

I'm trying to make a C program to generate a diamond as exemplified in the image below: I have not been able to come up with an algorithm that generates the required characters and spaces on each line. What would be a reasonable way to...
asked by 09.04.2015 / 02:03
2
answers

How to transform a mathematical expression into C language

How can I turn it into C language?     
asked by 29.08.2015 / 01:10
2
answers

Language C - The structure jumps directly to ELSE by ignoring IF parameters [duplicate]

#include<stdio.h> int main(){ //Escolhe entre nome do personagem e classe int p,c; printf("RPG teste\n"); printf("Digite um nome para o seu(a) personagem:"); scanf("%s",&p); printf("Escolha uma classe, digi...
asked by 23.09.2018 / 04:55
1
answer

How to do it on fewer lines?

I have this exercise on C to calculate the distance between two points using structs , but it repeats much the point code, for x and y , like doing on less lines or using array ? #include <stdio.h> #include <stdlib...
asked by 16.05.2016 / 21:46
4
answers

problem with C code translation

I would like to turn this into C code I have already done everything I just have the problem in the part "If MEDIA >=6 and FALTAS <=10 Then" mainly in the part of And I do not know how I will separate the account. Programa C...
asked by 03.04.2014 / 18:11
2
answers

Sudoku does not print screen responses

This code does not have any errors, however the program does not solve the game (it does not print answers on the screen): #include<stdio.h> #include<stdlib.h> #include <time.h> #define N 9 #define D 4 void facil(void); voi...
asked by 10.11.2014 / 21:47