SlideShare a Scribd company logo
1 of 18
http://eglobiotraining.com
The first programming
 source code will show us
 the sum or difference or
 product of two integers
 by using C language
 programming.

      http://eglobiotraining.com
#include<stdio.h>
#include<conio.h>
int main()
{ int num1,num2,ans,ch;
printf("enter 1st integer: ");
scanf("%d", &num1);
printf("enter 2nd integer: ");
scanf("%d", &num2);
printf(" press 1 for ADD, 2 for DIFFERENCE and 3 for PRODUCT:");
scanf("%d", &ch);
switch(ch)
{
     case 1: ans=num1+num2;
       break;
        case 2: ans=num1-num2;
        break;
         case 3: ans=num1*num2;
        break;
        default: printf("you entered wrong number!");
        }
        printf("answer is %d", ans);
        getch();
      }




                        http://eglobiotraining.com
For example on this programming source code:
The user input 3 as the 1st integer while 4 as the 2nd
 integer. The user then chooses to add them so the
 programming output is 7.




              http://eglobiotraining.com
The second programming
 source code will determine
 whether to solve for volume of
 a irregular prism or volume of a
 pyramid by using C language
 programming.


        http://eglobiotraining.com
#include <stdio.h>
#include<conio.h>

main()
{
   int opcode;
   int a, b,c=3;
   int result;

        printf("Enter Your Choice: 1 - Volume of irregular prism , 2 - Volume of pyramid: ");
        scanf("%d", &opcode);
        printf("Enter Base:");
        scanf("%d", &a);
        printf("Enter Height:");
        scanf("%d", &b);

        switch(opcode)
        {
        case 1:
            result = a * b;
            printf("%d * %d = %d", a, b, result);
            break;
        case 2:
            result = a*b/c;
            printf("%d *%d/%d = %d", a, b,c, result);
            break;
    }
        getch();
}
                                http://eglobiotraining.com
For example on this programming source code:
The user like to solve for the volume of a pyramid. The
 user input 4 as the base and 6 as the height. The
 programming output of the volume of the pyramid is
 8.




               http://eglobiotraining.com
The 3rdprogramming
 source code will
 determine the area of a
 rectangle or a triangle by
 using C language
 programming.

       http://eglobiotraining.com
#include <stdio.h>
#include<conio.h>

main()
{
       int opcode;
   int a, b,c=2;
   int result;

    printf("Enter Your Choice: 1 - Area of parallelogram, 2 - Area of triangle: ");
    scanf("%d", &opcode);
    printf("Enter Base:");
    scanf("%d", &a);
       printf("Enter Height:");
    scanf("%d", &b);

    switch(opcode)
    {
    case 1:
        result = a * b;
        printf("%d * %d = %d", a, b, result);
        break;
       case 2:
       result = a*b/c;
        printf("%d *%d/%d = %d", a, b,c, result);
        break;

    }
    getch();
                                 http://eglobiotraining.com
}
For example on this programming source
code:
The user wants to know the area of the parallelogram
  and he input 6 as the base and 3 as the height. So
  the programming output of the area of a
  parallelogram is 24.




              http://eglobiotraining.com
The 4 th
       programming source
 code will show the addition,
 subraction, multiplication
 and division of 2 numbers by
 using C language
 programming.


           http://eglobiotraining.com
#include <stdio.h>
#include<conio.h>

main()
{
   int opcode;
   int a, b;
   int result;

    printf("Program for Addition, Subtraction, Multiplication and Divisionn");
    printf("Enter Your Choice: 1 - Add, 2 - Sub, 3 - Mul, 4 - Div: ");
    scanf("%d", &opcode);
    printf("Enter First Number:");
    scanf("%d", &a);
    printf("Enter Second Number:");
    scanf("%d", &b);

    switch(opcode)
    {
    case 1:
        result = a + b;
        printf("%d + %d = %d", a, b, result);
        break;
    case 2:
        result = a - b;
        printf("%d - %d = %d", a, b, result);
        break;
    case 3:
        result = a * b;
        printf("%d * %d = %d", a, b, result);
        break;
    case 4:
        result = a / b;
             printf("%d / %d = %dn ", a, b, result, a, b, a % b);
        break;
    }
    getch();
}                                            http://eglobiotraining.com
For example on this programming source
code:
The user wants to know the quotient of two numbers.
  Let 100 be the 1st number while 20 will be the 2nd
  number. So the programming output of this program
  is 5.




              http://eglobiotraining.com
The fifth programming source
 code will determine the
 square or cube of a number
 by using C language
 programming.



       http://eglobiotraining.com
#include<stdio.h>
#include<conio.h>
int main()
{ int num1,ans,ch;

printf("enter 1st integer: ");
scanf("%d", &num1);

printf(" press 1 for SQUARE, 2 for CUBE:");
scanf("%d", &ch);
switch(ch)
{
     case 1: ans=num1*num1;
      break;
      case 2: ans=num1*num1*num1;
      break;

      default: printf("you entered wrong number!");
      }
      printf("answer is %d", ans);
      getch();
      }




                                 http://eglobiotraining.com
For example on this programming source
code:
The user input 20 as the number. The user wants to
  know what is the square of 20. So the programming
  output is 400.




              http://eglobiotraining.com
http://www.slideshare.net/franzneri/comp2




             http://eglobiotraining.com
SUBMITTED TO: MR. ERWIN GLOBIO

SUBMITTED BY: FRANZ NERI CLEMEÑA

FM09205 W-S 10:30AM-12:00PM



Official Website is http://eglobiotraining.com/




               http://eglobiotraining.com

More Related Content

What's hot

Simple c program
Simple c programSimple c program
Simple c programRavi Singh
 
C programming Lab 2
C programming Lab 2C programming Lab 2
C programming Lab 2Zaibi Gondal
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given numberMainak Sasmal
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programsPrasadu Peddi
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1Zaibi Gondal
 
C program to check leap year
C program to check leap year C program to check leap year
C program to check leap year mohdshanu
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentalsZaibi Gondal
 
Testing lecture after lec 4
Testing lecture after lec 4Testing lecture after lec 4
Testing lecture after lec 4emailharmeet
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CBUBT
 
Chapter 5 exercises Balagurusamy Programming ANSI in c
Chapter 5 exercises Balagurusamy Programming ANSI  in cChapter 5 exercises Balagurusamy Programming ANSI  in c
Chapter 5 exercises Balagurusamy Programming ANSI in cBUBT
 
C Language Programs
C Language Programs C Language Programs
C Language Programs Mansi Tyagi
 
Chapter 5 Balagurusamy Programming ANSI in c
Chapter 5 Balagurusamy Programming ANSI  in cChapter 5 Balagurusamy Programming ANSI  in c
Chapter 5 Balagurusamy Programming ANSI in cBUBT
 

What's hot (19)

Simple c program
Simple c programSimple c program
Simple c program
 
C programming Lab 2
C programming Lab 2C programming Lab 2
C programming Lab 2
 
First c program
First c programFirst c program
First c program
 
Practical write a c program to reverse a given number
Practical write a c program to reverse a given numberPractical write a c program to reverse a given number
Practical write a c program to reverse a given number
 
Lab 1
Lab 1Lab 1
Lab 1
 
B.Com 1year Lab programs
B.Com 1year Lab programsB.Com 1year Lab programs
B.Com 1year Lab programs
 
Programming egs
Programming egs Programming egs
Programming egs
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1
 
C program to check leap year
C program to check leap year C program to check leap year
C program to check leap year
 
Programming fundamentals
Programming fundamentalsProgramming fundamentals
Programming fundamentals
 
Ansi c
Ansi cAnsi c
Ansi c
 
Testing lecture after lec 4
Testing lecture after lec 4Testing lecture after lec 4
Testing lecture after lec 4
 
Chapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in CChapter 4 : Balagurusamy Programming ANSI in C
Chapter 4 : Balagurusamy Programming ANSI in C
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
Chapter 5 exercises Balagurusamy Programming ANSI in c
Chapter 5 exercises Balagurusamy Programming ANSI  in cChapter 5 exercises Balagurusamy Programming ANSI  in c
Chapter 5 exercises Balagurusamy Programming ANSI in c
 
C Language Programs
C Language Programs C Language Programs
C Language Programs
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
Chapter 5 Balagurusamy Programming ANSI in c
Chapter 5 Balagurusamy Programming ANSI  in cChapter 5 Balagurusamy Programming ANSI  in c
Chapter 5 Balagurusamy Programming ANSI in c
 
C Programming
C ProgrammingC Programming
C Programming
 

Viewers also liked

Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacjaJakub Szotek
 
Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacjaJakub Szotek
 
Jsimko wikt2012 v01
Jsimko wikt2012 v01Jsimko wikt2012 v01
Jsimko wikt2012 v01Jakub Šimko
 
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...Jakub Šimko
 
Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacjaJakub Szotek
 

Viewers also liked (7)

Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacja
 
Health Affairs
Health AffairsHealth Affairs
Health Affairs
 
Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacja
 
Jsimko wikt2012 v01
Jsimko wikt2012 v01Jsimko wikt2012 v01
Jsimko wikt2012 v01
 
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
Classsourcing: Crowd-Based Validation of Question-Answer Learning Objects @ I...
 
Html
HtmlHtml
Html
 
Familo prezentacja
Familo prezentacjaFamilo prezentacja
Familo prezentacja
 

Similar to comp2

C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFC BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFAbcdR5
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solutionyogini sharma
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Functionimtiazalijoono
 
some basic C programs with outputs
some basic C programs with outputssome basic C programs with outputs
some basic C programs with outputsKULDEEPSING PATIL
 
Chap 2 input output dti2143
Chap 2  input output dti2143Chap 2  input output dti2143
Chap 2 input output dti2143alish sha
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)Ashishchinu
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solutionKuntal Bhowmick
 
Itp practical file_1-year
Itp practical file_1-yearItp practical file_1-year
Itp practical file_1-yearAMIT SINGH
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]Abhishek Sinha
 
C program report tips
C program report tipsC program report tips
C program report tipsHarry Pott
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about CYi-Hsiu Hsu
 
Control structure of c
Control structure of cControl structure of c
Control structure of cKomal Kotak
 

Similar to comp2 (20)

C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHFC BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
C BASICS.pptx FFDJF/,DKFF90DF SDPJKFJ[DSSIFLHDSHF
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
 
some basic C programs with outputs
some basic C programs with outputssome basic C programs with outputs
some basic C programs with outputs
 
C lab
C labC lab
C lab
 
C
CC
C
 
Chap 2 input output dti2143
Chap 2  input output dti2143Chap 2  input output dti2143
Chap 2 input output dti2143
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
Hargun
HargunHargun
Hargun
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Cs291 assignment solution
Cs291 assignment solutionCs291 assignment solution
Cs291 assignment solution
 
Presentation1
Presentation1Presentation1
Presentation1
 
Itp practical file_1-year
Itp practical file_1-yearItp practical file_1-year
Itp practical file_1-year
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
 
C program report tips
C program report tipsC program report tips
C program report tips
 
C programs
C programsC programs
C programs
 
C Basics
C BasicsC Basics
C Basics
 
C file
C fileC file
C file
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about C
 
Control structure of c
Control structure of cControl structure of c
Control structure of c
 

comp2

  • 2. The first programming source code will show us the sum or difference or product of two integers by using C language programming. http://eglobiotraining.com
  • 3. #include<stdio.h> #include<conio.h> int main() { int num1,num2,ans,ch; printf("enter 1st integer: "); scanf("%d", &num1); printf("enter 2nd integer: "); scanf("%d", &num2); printf(" press 1 for ADD, 2 for DIFFERENCE and 3 for PRODUCT:"); scanf("%d", &ch); switch(ch) { case 1: ans=num1+num2; break; case 2: ans=num1-num2; break; case 3: ans=num1*num2; break; default: printf("you entered wrong number!"); } printf("answer is %d", ans); getch(); } http://eglobiotraining.com
  • 4. For example on this programming source code: The user input 3 as the 1st integer while 4 as the 2nd integer. The user then chooses to add them so the programming output is 7. http://eglobiotraining.com
  • 5. The second programming source code will determine whether to solve for volume of a irregular prism or volume of a pyramid by using C language programming. http://eglobiotraining.com
  • 6. #include <stdio.h> #include<conio.h> main() { int opcode; int a, b,c=3; int result; printf("Enter Your Choice: 1 - Volume of irregular prism , 2 - Volume of pyramid: "); scanf("%d", &opcode); printf("Enter Base:"); scanf("%d", &a); printf("Enter Height:"); scanf("%d", &b); switch(opcode) { case 1: result = a * b; printf("%d * %d = %d", a, b, result); break; case 2: result = a*b/c; printf("%d *%d/%d = %d", a, b,c, result); break; } getch(); } http://eglobiotraining.com
  • 7. For example on this programming source code: The user like to solve for the volume of a pyramid. The user input 4 as the base and 6 as the height. The programming output of the volume of the pyramid is 8. http://eglobiotraining.com
  • 8. The 3rdprogramming source code will determine the area of a rectangle or a triangle by using C language programming. http://eglobiotraining.com
  • 9. #include <stdio.h> #include<conio.h> main() {  int opcode; int a, b,c=2; int result; printf("Enter Your Choice: 1 - Area of parallelogram, 2 - Area of triangle: "); scanf("%d", &opcode); printf("Enter Base:"); scanf("%d", &a);  printf("Enter Height:"); scanf("%d", &b); switch(opcode) { case 1: result = a * b; printf("%d * %d = %d", a, b, result); break; case 2: result = a*b/c; printf("%d *%d/%d = %d", a, b,c, result); break; } getch(); http://eglobiotraining.com }
  • 10. For example on this programming source code: The user wants to know the area of the parallelogram and he input 6 as the base and 3 as the height. So the programming output of the area of a parallelogram is 24. http://eglobiotraining.com
  • 11. The 4 th programming source code will show the addition, subraction, multiplication and division of 2 numbers by using C language programming. http://eglobiotraining.com
  • 12. #include <stdio.h> #include<conio.h> main() { int opcode; int a, b; int result; printf("Program for Addition, Subtraction, Multiplication and Divisionn"); printf("Enter Your Choice: 1 - Add, 2 - Sub, 3 - Mul, 4 - Div: "); scanf("%d", &opcode); printf("Enter First Number:"); scanf("%d", &a); printf("Enter Second Number:"); scanf("%d", &b); switch(opcode) { case 1: result = a + b; printf("%d + %d = %d", a, b, result); break; case 2: result = a - b; printf("%d - %d = %d", a, b, result); break; case 3: result = a * b; printf("%d * %d = %d", a, b, result); break; case 4: result = a / b;  printf("%d / %d = %dn ", a, b, result, a, b, a % b); break; } getch(); } http://eglobiotraining.com
  • 13. For example on this programming source code: The user wants to know the quotient of two numbers. Let 100 be the 1st number while 20 will be the 2nd number. So the programming output of this program is 5. http://eglobiotraining.com
  • 14. The fifth programming source code will determine the square or cube of a number by using C language programming. http://eglobiotraining.com
  • 15. #include<stdio.h> #include<conio.h> int main() { int num1,ans,ch; printf("enter 1st integer: "); scanf("%d", &num1); printf(" press 1 for SQUARE, 2 for CUBE:"); scanf("%d", &ch); switch(ch) { case 1: ans=num1*num1; break; case 2: ans=num1*num1*num1; break; default: printf("you entered wrong number!"); } printf("answer is %d", ans); getch(); } http://eglobiotraining.com
  • 16. For example on this programming source code: The user input 20 as the number. The user wants to know what is the square of 20. So the programming output is 400. http://eglobiotraining.com
  • 17. http://www.slideshare.net/franzneri/comp2 http://eglobiotraining.com
  • 18. SUBMITTED TO: MR. ERWIN GLOBIO SUBMITTED BY: FRANZ NERI CLEMEÑA FM09205 W-S 10:30AM-12:00PM Official Website is http://eglobiotraining.com/ http://eglobiotraining.com