DIGIT-ARC read-only archive · snapshot: July 23, 2026

Raise-to in C

11 posts · originally from https://geek.digit.in/community/threads/raise-to-in-c.83279/

zegulas
zegulas Original post #1
Mar 22, 2008 at 4:38 PM
How to show x^2 in C?
Ecko
Ecko #2
Mar 22, 2008 at 4:46 PM
its pow function

#include <math.h>
z = pow( x, y );
zegulas
zegulas #3
Mar 22, 2008 at 4:54 PM
no no, i want to show it in printf, i dont want to raise actually!
Faun
Faun #4
Mar 22, 2008 at 5:10 PM
huh
QwertyManiac
Mar 22, 2008 at 5:17 PM
If you're using extended ASCII, you can do it using (char)253.

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

This should print 3²

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

It prints the same too.
zegulas
zegulas #6
Mar 22, 2008 at 9:21 PM
Thanx a lot QwertyManiac!! [:)]
Faun
Faun #7
Mar 23, 2008 at 2:50 AM
^^the orkut addiction's prime example
zegulas
zegulas #8
Mar 23, 2008 at 9: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
Mar 23, 2008 at 9:32 AM
Quit it guys, don't go off-topic.
Faun
Faun #10
Mar 23, 2008 at 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
zegulas #11
Mar 23, 2008 at 11:12 PM
So sorry T159, I misunderstood you.