PDA

View Full Version : Raise-to in C


zegulas
22-03-2008, 04:38 PM
How to show x^2 in C?

Ecko
22-03-2008, 04:46 PM
its pow function

#include <math.h>
z = pow( x, y );

zegulas
22-03-2008, 04:54 PM
no no, i want to show it in printf, i dont want to raise actually!

T159
22-03-2008, 05:10 PM
huh

QwertyManiac
22-03-2008, 05:17 PM
If you're using extended ASCII, you can do it using (char)253.

Sample:
#include <stdio.h>
// ASCII
int main(void)
{
(void)printf("3%c\n",253);
return 0;
}

This should print 3²

Or in Unicode:
#include <stdio.h>
// UTF-8
int main(void)
{
(void)printf("3\u00B2",a);
return 0;
}
// Requires compilation by a C++ or C99 standard compiler.

It prints the same too.

zegulas
22-03-2008, 09:21 PM
Thanx a lot QwertyManiac!! [:-)]

T159
23-03-2008, 02:50 AM
^^the orkut addiction's prime example

zegulas
23-03-2008, 09:23 AM
T159, I agreed to what you said above! But don't post stuff like "huh" as you have done above. The post counts don't matter, if you have information to share then just do that.

QwertyManiac
23-03-2008, 09:32 AM
Quit it guys, don't go off-topic.

T159
23-03-2008, 11:36 AM
T159, I agreed to what you said above! But don't post stuff like "huh" as you have done above. The post counts don't matter, if you have information to share then just do that.
the huh part was for phenom, now it seems he has deleted his post

sorry i dont care abt post counts, you will find my most of the posts in chit chat section and gamers section.

sorry if u felt bad abt that :(, ask anything abt algorithms and language to Qwertymaniac

zegulas
23-03-2008, 11:12 PM
So sorry T159, I misunderstood you.