Showing posts with label c. Show all posts
Showing posts with label c. Show all posts

Tuesday, February 14, 2017

How to Change Add themes in CodeBocks C C IDE

How to Change Add themes in CodeBocks C C IDE


In this video tutorial i will show you how to change the background theme in CodeBlocks IDE




Note-Theme Code link-https://docs.google.com/file/d/0B-nG6oJdQsyRVl83MGRDNkJLN1U/edit?pli=1

Enjoy this awesome trick...& for more tricks keep visiting this blog...:)


REGARDS
Shankha Jana


Available link for download

Read more »

Sunday, January 8, 2017

Hà m sắp xếp mảng tăng dần trong lập trình C

Hà m sắp xếp mảng tăng dần trong lập trình C



Run demo: http://www.tutorialspoint.com/compile_c_online.php

Hàm s?p x?p m?ng t?ng d?n trong l?p trình C
C 2016
#include <stdio.h>
int a[100];
//Khai báo m?ng array kích th??c 100
int main()
//Hàm thân ch?y ch??ng trình b?t bu?c có
{
int i,j,n,k;
//Khai báo bi?n ki?u int
printf("Nhap so mang cua phan tu: ");
//Hi?n th? màn hình
scanf("%d", &n);
//Nh?p vào s? l?n l?p
for (i = 0; i < n; i++)
//vòng l?p for
{
printf("nhap phan tu thu %d: ", i + 1);
scanf("%d", &a[i]);
//Nh?p vào m?ng s? i
}
for (i = 0; i < n-1;i++){
for (j = i+1; j < n;j++){
if (
a[i]>a[j]) //T?ng d?n or Gi?m d?n a[i]<a[j]
{
k = a[i]; //k là bi?n t?m l?u giá tr?
a[i] = a[j]; //th?c hi?n ??i ch?
d?i chó
a[j] = k;

}
}
}
printf("mang sau khi da sap xep la: ");
for (i = 0; i < n; i++) {
printf(" %d ", a[i]);
//M?i l?n l?p in ra m?ng i
}
}
Ki?n Th?c C?n Có:
1. Khai báo ki?n int ?
2. Khai báo ki?u Array m?ng ? M?ng 1 chi?u và m?ng 2 chi?u là gì?
3. printf là gì?
4. scanf là gì ?
5. Vòng l?p for là gì ?


Available link for download

Read more »

Sunday, November 20, 2016

How to Display A programs own Source Code as Output in C programming Language

How to Display A programs own Source Code as Output in C programming Language


Though you may think that is  problem is quite complex but actually ,the concept behind this program is very simple.

A predefined macro __FILE__ contains the location of a C programming file.we will be using this macro in our program.

Source Code-


 1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
int main() {
FILE *fp;
char c;
fp = fopen(__FILE__,"r");
do {
c = getc(fp);
putchar(c);
}
while(c != EOF);
fclose(fp);
return 0;
}

Output-



Available link for download

Read more »

Sunday, November 13, 2016

How to find remainder without using MODULUS OPERATOR in C

How to find remainder without using MODULUS OPERATOR in C


Here is the source code for finding remainder without using MODULUS OPERATOR in C Language


 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<stdio.h>
int main()
{
int a,b,c;
printf("Enter 1st no ");
scanf("%d",&a);
printf("Enter 2nd no ");
scanf("%d",&b);
c=a/b;
c=c*b;
b=a-c;
printf("The remainder is %d ",b);

return 0;


}

Output-


Available link for download

Read more »

Sunday, October 16, 2016

Hà m đổi chỗ dùng con trỏ trong lập trình C

Hà m đổi chỗ dùng con trỏ trong lập trình C


Hàm ??i ch? dùng con tr? trong l?p trình C
C 2016
#include<stdio.h>

//viet mot ham de trao doi hai gia tri va chuyen vao 2 so kieu int
void swap(int *num1, int *num2) {
int temp;
//khai bao bien luu tru
temp = *num1;
*num1 = *num2;
*num2 = temp;
}

int main() {
int num1, num2;
//Khai bao bien kieu int

//Nhap vao so num1 va num2
printf(" Nhap so thu nhat: ");
scanf("%d", &num1);
printf(" Nhap so thu hai: ");
scanf("%d", &num2);

swap(&num1, &num2);
//goi ham doi cho

//In ra man hinh
printf(" Sau khi trao doi:");
printf(" So thu nhat: %d", num1);
printf(" So thu hai: %d", num2);

return (0);
}
Chú ý: Ch??ng trình s? ch?y t? trên xu?ng d??i swap ch?y tr??c nên
ph?n In ra màn hình s? l?y giá tr? c?a swap khi ?ã ??i ch?


Available link for download

Read more »