Hoaxblog.com
Pages:
Categories:
- Apache (8)
- backup (1)
- cache (2)
- Cpanel/WHM (18)
- ddos (1)
- exam (1)
- file hosting (2)
- General (14)
- Hosting (4)
- Iptables/Firewall (1)
- It’s me (2)
- linux (3)
- Linux Shell (16)
- Make Money Online (2)
- Mysql (2)
- mysqldump (1)
- php (1)
- Programming (3)
- proxy (3)
- Reseller (1)
- SEO (1)
- Servers (23)
- VPN (1)
- whmcs (1)
- Windows (6)
- wordpress (2)
Blogroll
Meta:
Archive for the 'Programming' Category
04 19th, 2007
There is no standard library files in C Programming which can do complex number calculations. According to bionomial theoram there can be Complex and Real roots. But as C doesn’t bother with Complex numbers so, we need to use real number canculation to get the complex root at a+bi form.
Here is a short example what i have done:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <stdio.h> #include <math.h> #include <conio.h> void main() { double a,b,c,d,e,f,g; clrscr(); printf("Please type the numbers"); scanf("%lf%lf%lf",&a,&b,&c); d=(b*b)-(4*a*c); if (d>=0) { if (d==0) { printf("It has one real root\n"); e=(-b+sqrt(d))/(2*a); printf("Here is the root: %.2lf\n",e); } else { printf("It has real roots\n"); e=(-b+sqrt(d))/(2*a); printf("First Real Root: %.2lf\n",e); e=(-b-sqrt(d))/(2*a); printf("Second Real Root: %.2lf\n",e); } } else { printf("It has complex roots\n"); f=-d; e=(-b/(2*a)); g=(sqrt(f)/(2*a)); printf("First Complex Root: %.2lf+%.2lfi\n",e,g); printf("Second Complex Root: %.2lf-%.2lfi\n",e,g); } getch(); } |
If you enter some value for this programme like 1 3 1 for a,b and c according to a Quadratic or Bionomial Equation then the result will be with two real number outputs. If you enter 1 2 1 for a,b and c then the result will be one real number output as at that time both roots will be equal. And if you enter 1 1 1 then the result will be with two complex numbers.
Happy Coding! ![]()
04 13th, 2007
Today i was trying to figure a programme which will show the ASCII numbers for different characters. It is really a simple code, but really handy. Lets have a look into the code first:
1 2 3 4 5 6 7 8 9 10 | #include <stdio.h> #include <conio.h> void main() { unsigned char a; for(a=32;a<128;a++) printf("%3d = ā%cā\t",a,a); getch(); } |
Here what is happening is we are startig a look from 32 and ending at 127 as we already know ASCII Numbers ranged from 32-127 and all are serialed, so what i have done is only executed all the equivalent character with the specific number. And definitely now the code has become a simple programme which will display some useful informations for you ![]()
04 13th, 2007
I didn’t work with C before. I have a good experience with php and mysql definitely. But for my course intention, now i m in need to get into C :). Today i was trying to figure out a calculator with some arithmatic operators and conditionals. It is possible to use some math operation to make a full featured cool calculator, but as i said, i have made a simple calculator here with some basic functions.