Giter Site home page Giter Site logo

fundamentos-c's Introduction

Fundamentos de programación

Clase 1 de programación

  • Comentarios
// comentario de línea
/* Comenatario de bloque*/
  • Declaración de variables
int variable variable entera
float variable flotante 
char variable caracter
  • Secuencias de escape
    • \n nueva linea
    • " doble comilla
    • ' comilla simple
    • \ diagonal inversa
    • \t tabulador

Clase 2 Operaciones con variables

  • Función main
  • Operaciones simples con variables enteras

Clase 3

  • Deciciones if e if else
if (condicion_verdadera){
	//en caso de ser verdaro entra a ejecutar esta sección
}else{
	//De lo contrario se ejecuta este bloque de código
}
  • Formato (printf("texto"))
printf("Recibe un valor entero %d, recibe un valor flotante %f, recibe un valor flotante con maximo 2 decimales %.2f");

Clase 4

  • Funciones trigonometricas
#include <math.h> //importo la libreria de funciones matematicas

	double seno = sin((PI * angulo) / 180); //calculo el seno del angulo
	double coseno = cos((PI * angulo) / 180); //calculo el coseno del angulo
	double tangente = tan((PI * angulo) / 180); //calculo la tangente de
  • Funciones matematicas
	int valorAbsolutoEntero = fabs(-18); // retorna el valor absulo del argumento
	float valorAbsolutoFlotante = fabs(-4.7); // retorna el valor absulo del argumento
		
	printf("%d\n", valorAbsolutoEntero);
	printf("%f\n", valorAbsolutoFlotante);
	
	int x = 3;
	float exponente = exp(x);
	printf("e elevado a la %d: %f \n",x, exponente);
	
	float valor = 16.6;
	float raiz = sqrt(valor); //sqrt calcula la raiz cuadra del argumento
	
	printf("La raiz cuadrada de %f es: %f\n", valor, raiz);
	
	int base = 2;
	int pot = 3;
	int potencia = pow(base, pot); //x^y el primer valor es la base y el segundo es la potencia
	printf("La potencia de %d elevado a la %d es: %d",base, pot, potencia);
	 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.