Search found 2 matches

by mbd01
Wed Sep 28, 2005 10:17 pm
Forum: Volume 1 (100-199)
Topic: 153 - Permalex
Replies: 32
Views: 18394

Compile Error

Hi I have solved prob#153 in my computer. Language- Turbo C 3.0
I also solved Prob#100
solution of Prob#153 is:

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

double fact(int x)
{
double p=1;
for(;x>=1;x--)
{
p=p*x;
}
return p;
}

int sortfunction(const void *a, const void *b ...
by mbd01
Mon Sep 26, 2005 8:51 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 318270

3n+1 problem

Hi, I am absolutely new here. I wrote a program for problem#100 and the error message is "Wrong Answer"
The program is here........

#include<stdio.h>
main()
{
long int n,x,y;
int i,max;

while(fscanf(stdin,"%ld%ld",&x,&y)!=EOF)
{
printf("%ld %ld ",x,y);
if(y<x) { n=x;x=y;y=n;}
max=0;
for(;x ...

Go to advanced search