comp2
Upcoming SlideShare
Loading in...5
×
 

comp2

on

  • 208 views

 

Statistics

Views

Total Views
208
Views on SlideShare
208
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    comp2 comp2 Presentation Transcript

    • 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 sourcecode: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 sourcecode: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 sourcecode: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 GLOBIOSUBMITTED BY: FRANZ NERI CLEMEÑAFM09205 W-S 10:30AM-12:00PMOfficial Website is http://eglobiotraining.com/ http://eglobiotraining.com