Baghaee.com
  • Home
  • C programming
  • Arduino
  • Term Projects
Baghaee.com » C programming
Skip to content
  • Home
  • EDUCATION
  • PUBLICATIONS
    • cognitive signal processing-IEICE Trans
    • cognitive signal processing-IEEE UKSIM
    • cognitive signal processing-IEEE SIU
    • WSN-Energy Harvester-Energies
    • WSN-Energy Harvester-IEEE TIWDC
    • WSN-Energy Harvester-IEEE European Wireless
    • Wearable battery-less WSN -Sensors & Actuators: A. Physical
  • EXPERIENCE
  • COMPUTER SKILLS
  • Services
  • PROFESSIONAL MEMBERSHIPS
  • CONTACT
  • Download CV

C Programming Tutorial – 4 – Define an Integer variable and use it :

August 15, 2016
C programming
Tags: C Programming, Conversion, Conversion decimal, Integer variable, New line in C, printf, Tutorial

Code:
—————————

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

int main()
{

int age;
int current_year;
int birth_year;
current_year=2016;
birth_year=1983;
age=current_year-birth_year;
printf(“I am %d years old \n”,age);

return 0;

}

Post navigation

← Previous post link Next post link →

Related posts

  • C Programming Tutorial – 18 – ++ in Left and Right:

    Note: // ++ in left first add 1 to viable and then calculate the equation.  // ++ in right first calculate the […]

    C Programming Tutorial – 17 – Short form of if + add a string :

    Note: //Example for Short form of if+add a string Code: ————————— #include <stdio.h> #include <stdlib.h> int main() { int friends; […]

    C Programming Tutorial – 16 – Short form of if :

    Note: //Short form of if:   ( ….. ) ?   ….. : ….. ; Code: ————————— #include <stdio.h> #include <stdlib.h> int […]

    C Programming Tutorial – 15 – Extract a character from an array + compare it with a character :

    Note: //lastname[3] : Extract the 4th (not the 3rd) character of array lastname. //lastname[3] > ‘M’   : compare the 4th character […]

  • C Programming Tutorial – 14 – if – else if :

    Code: ————————— #include <stdio.h> #include <stdlib.h> int main() { float agrade,bgrade,cgrade; printf(“Please enter you 3 grades. \n”); scanf(” %f”, &agrade); […]

    C Programming Tutorial – 13 – if :

    Code: ————————— #include <stdio.h> #include <stdlib.h> int main() { int Yourage; char gender; printf(“How old are you?\n”); scanf(” %d”,&Yourage); printf(“what […]

    C Programming Tutorial – 12 – change the property of a variable:

    Note: //Use (float) or (int) or … before any variable to change that variable to float or int or …: […]

    C Programming Tutorial – 10 – define multiple variable at the same time :

    Code: ————————— #include <stdio.h> #include <stdlib.h> int main() { float aa,bb,cc, balance;                 […]

CopyRight 2009-2016 Baghaee.com All rights reserved
  • Home
  • C programming
  • Arduino
  • Term Projects