tag:blogger.com,1999:blog-4648894684730150002024-03-14T13:19:03.857+05:30Program MatrixAll the C, C++, Java & C# programs that you ever required!Anonymoushttp://www.blogger.com/profile/07525613654218657571noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-464889468473015000.post-33295841181605263552011-01-25T21:35:00.000+05:302011-01-25T21:35:34.270+05:30Java: Reverse a numberThis program will reverse a long and store it in another.
class NumRev
{
public static void main(String ar[])
{
long num = 1357912; /* Try with diff values */
long rev = 0;
int i = (((Long)num).toString()).length(); /* No of digits */
System.out.println("Original Number: " + num);
for(i-=1; num!=0; i--)
{
long rem = num % 10;
rev += (rem * Math.pow(10, i));
num /= 10;
Anonymoushttp://www.blogger.com/profile/07525613654218657571noreply@blogger.com0tag:blogger.com,1999:blog-464889468473015000.post-1274777973328236472009-08-04T21:22:00.005+05:302009-08-05T22:30:18.212+05:30Accept a Password string, displaying it as *This program will accept a string from the user as a password, displaying *'s instead of the data entered by the user.Lang: C#include(stdio.h)#include(conio.h)#include(string.h)void main() /* Or int main() with return 0 */{char pass[20];int i;printf("Enter password: ");for(i=0; i<20; i+=1){pass[i] = getch();if(pass[i] == '\r') /* The carriage return escape sequence */break;printf("*");}pass[i]Anonymoushttp://www.blogger.com/profile/07525613654218657571noreply@blogger.com0tag:blogger.com,1999:blog-464889468473015000.post-34056391271044869472009-05-19T13:58:00.003+05:302009-08-04T21:27:45.315+05:30Introduction to the siteThis blog is meant to be a guide for computer programs in various languages. It is not, I repeat, NOT meant to be a definitive database or a place from where you could copy school assignments. Currently Program Matrix has only C, but hopefully C# is soon on its way.The programs here are meant to be for learners. I will, therefore, provide comparatively easier programs, leaving anything 'Anonymoushttp://www.blogger.com/profile/07525613654218657571noreply@blogger.com0