• Home
  • Disclaimer
  • Privacy Policy
  • Contact Us

Any Coding Here

providing coding tutorial for learning and sharing experiences

Select Menu
  • Home
  • Desktop Programming
    • C
    • Visual Basic
    • Java
    • Phyton
  • Web programming
    • HTML
    • PHP
    • Java Script
    • Perl
    • Responsive Cek
  • Sitemap
  • Static Page
  • Error Page
Home » C LANGUAGE » DESKTOP » Add Two Integer:C Language

Friday, 13 November 2015

Add Two Integer:C Language

dimas mu
Add Comment
C LANGUAGE, DESKTOP
Friday, 13 November 2015
Add Two Integer:C Language
Add Two Integer:C Language

add two integer in c language is one of the simplest program in this language.The discussion today we will try to make this program and ok let's see.

#include <stdio.h>
int main()
{
int integer1; /*first variable to input number*/
int integer2; /*second variable to input number*/
int sum; /*a variable to keep the sum*/
    printf("add first number = ");scanf("%d",&integer1);
    printf("add second number = ");scanf("%d",&integer2);
    sum = integer1 + integer2;
    printf("the sum is = %d",sum);
    return 0;
}

EXPLANATION

#include <stdio.h> 
stdio.h Is a preprocessor directive.Lines beginning with # and processed by the preprocessor before compilation.
int main(void)
int main part of the c language in a program building block called functions,one of which should be main function.
int integer1;
int integer2;
int integer3;
the name of the integer 1,integer 2, integer 3 is the name of a variable. a variable is a location in memory where a value is stored for use by a program.And int form C language is one of the data type in C language.

printf("add first number = ");scanf("%d",&integer1);
The above program is used to display the input literal numbers(add first number) on the screen and position the cursor at the beginning of the next line.And use scanf for enter data points from the keyboard.


sum = integer1 + integer2;
printf("the sum is = ",sum);
return 0;
sum = integer1 + integer2 used to add input that had been inserted.
printf below the sum is used to print the results from the sum of the two variables that have been in the declaration.
return 0; indicates the program stops perfectly.

ok guys how? easy and very simple is not it? in the next post we will get to know about the function of the c language. ok up here first and gratitude.
the result of the summation
the result of the summation

Like this article? Please Share: Facebook Twitter Google+
0 comments to "Add Two Integer:C Language"

Newer Post Home
Subscribe to: Post Comments (Atom)

Entri Populer

Labels

  • C LANGUAGE
  • DESKTOP
  • HTML
  • JAVA
  • PHP
  • VISUAL BASIC
  • WEB PROGRAMING
Powered by Blogger.

Blog Archive

  • ►  2017 (1)
    • ►  February (1)
  • ►  2016 (5)
    • ►  December (2)
    • ►  November (3)
  • ▼  2015 (7)
    • ▼  November (7)
      • create a canvas in:HTML5
      • a first step coding HTML5:HTML 5
      • examples of plural selection switch statement:C La...
      • example problems statement for:C Language
      • sample program "FOR":C Language
      • introducing visual basic programming
      • Add Two Integer:C Language

Labels

  • C LANGUAGE
  • DESKTOP
  • HTML
  • JAVA
  • PHP
  • VISUAL BASIC
  • WEB PROGRAMING

About Me

dimas mu
View my complete profile
Copyright 2015 Any Coding Here - All Rights Reserved
Template By Jenny Psychicfio Distributed by Kaizentemplate.