Your SlideShare is downloading. ×
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
comp2
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
121
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. http://eglobiotraining.com
  • 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 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
  • 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 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
  • 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 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
  • 17. http://www.slideshare.net/franzneri/comp2 http://eglobiotraining.com
  • 18. SUBMITTED TO: MR. ERWIN GLOBIOSUBMITTED BY: FRANZ NERI CLEMEÑAFM09205 W-S 10:30AM-12:00PMOfficial Website is http://eglobiotraining.com/ http://eglobiotraining.com

×