Translate

Bu Blogda Ara

C programming etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
C programming etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

6 Mart 2018 Salı

Algorithm To Create A Triangle (4)





Algorithm To Create A Triangle (3)


Algorithm To Create A Triangle (2)


Algorithm To Create a Triangle



Square Root Of Any Number

Square Root Of Any Number

Introduction for do while Statement

#include<stdio.h>
int main(){

 int counter=1;


 /*
Regardless of condition of while,first of all  the program execute the printf function inside the do and it will not repeat it again.It will continue with while and when while condition does not suitable for that specific condition while will end.*/
 do{
  printf("%d\n",counter);
  }
  while(++counter<=1);
/*In the beginning the value of counter is 1 and It print the it.After that by statement ++counter we increment the value of counter by 1.*/




 return 0;
}

22 Şubat 2018 Perşembe

Create Numbers Randomly

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(){
int x=8;
srand(time(NULL));


{
int x=rand()%6;
printf("%d",x);

}
printf("\n%d",x);
return 0;
}

7 Ekim 2017 Cumartesi

Base Converter: From decimal to any desired base.


#include <stdio.h>

int main()
 {

int exit;
int k=1;
printf("Press -1 to exit\n");

printf("To continue press any integer.");

scanf("%d",&exit);


while(exit!=-1){
 int number,base,remainder,counter=0;
int parametre=0;
printf("Number in decimal base:");
scanf("%d",&number);
printf("Base you want to convert.");
scanf("%d",&base);


int array[100]={0};
while(number>=0){

 if(number==1|| number==0){

  array[parametre]=number;

  break;


 }
  remainder=number%base;//

 array[parametre]=remainder;

 number=(number-remainder)/base;

 parametre++;
 counter++;

}
int control;
for( control=counter;control>=0;control--){

 printf("%d",array[control]);
 printf(" ");
}

 printf("\n");

 if(k==5){
  printf("Press -1 to exit\n");

printf("To continue press any key.");

scanf("%d",&exit);


k=1;


 }
 k++;
}

return 0;
}