C

How to create empty star using C


 This is the C code for creating above star.


//www.codeSriLanka.blogspot.com
//www.codeSriLanka.blogspot.com
//14/09/2011
#include<stdio.h>


int main(){
    int i,j,k;
    for(i=1;i<=5;i++){
        for(j=15;j>=i;j--){
        printf(" ");
        }
        for(k=1;k<=i;k++){
        if(k==1 || k==i){
        printf("* ");
        }
        else
        printf("  ");
        }
        printf("\n");
    }

Read More>>

 

2.C code for bubble sort using pointers

//UVA WELLASSA UNIVERSITY
//SORTING TECHNIQUES - C DATA STRUCTURE
//Iimplement Bubble Sort Technique using pointers.
//Program by:- EDIRISINGHE E.D.M.
//TESTED:- OK



#include<stdio.h>


int main(){    //main function
    int a[5];
    int i,temp,j,k;     //variables for loops
    int *arrPtr=a;         //assign array to the pointer
    for(i=0;i<5;i++)    //for loop for getting values to the array
    {
        printf("Enter array values : ");
        scanf("%d",&a[i]);
    }            //end of for loop
        
Read More>>>

linkwithin

go