Name : Sean Vandet
Major : D4 TMD ITB Batch 6
Sorting in c programming Sorting used to mean simply as massaging a data in one data set that don't most massage. Address is the location in memory where the value of the variable is stored. Pinter is a variable whose value is also an address.
#include <stdio.h>
#include <stdlib.h>
void swapValue (int *tIntA, int *tIntB);
int main() {
int tListAngka[20] = {1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2};
int tSwap;
int tUrutan;
//repeat and check statement
do {
tSwap = 0;
//repeat tUrutan = 1 end process when tUrutan = 18
for(tUrutan=0;tUrutan<19;tUrutan++)
{
if(tListAngka[tUrutan] < tListAngka[tUrutan+1])
{
//one varaible has address and value
swapValue(&tListAngka[tUrutan], &tListAngka[tUrutan+1]);
tSwap = 1;
}
}
} while(tSwap == 1); //exit do()
//repeat statement for loop
for(tUrutan=0;tUrutan<20;tUrutan++)
{
//tUrutan 0 - 18
Name : Sean Vandet
Major : TMD
Program calculate volume pyramid and sphere with C Programming language.
use do-while loop and if-else if statment and break keyword:
link to youtube:
http://www.youtube.com/watch?v=s28C_RhvQg0&feature=youtu.be
Thank you!
#include<stdio.h> //library of input and output standard
#include<stdlib.h> //library of system("pause")
int main(void) //main() method for compile the program
{
float a, b, h, areaTripezium; //declare variable (float)
printf("Please enter the number: \n"); //show output on screen
printf("a is: ");
scanf("%f",&a); //input the data from keyboard
printf("b is: ");
scanf("%f",&b);
printf("h is: ");
scanf("%f",&h);
areaTripezium = h * (a + b) /2; //calculate area of Tripezium
printf("Area of Tripezium is: %f\n", areaTripezium);
system("pause"); //pause the system
return 0; //return value to the user (false)
}