i m getting RT error.can anyone tell me why?
#include <stdio.h>
#include <string.h>
int main()
{
char msg[103];
while(gets(msg))
{
int len = strlen(msg)-1;
int temp=0;
while(len>=0)
{
if(msg[len]>='0' && msg[len]<='9')
{
temp = (int)msg[len] - '0';
if(len-1>=0)
{
temp = temp ...
Search found 5 matches
- Thu Oct 22, 2009 8:03 pm
- Forum: Volume 4 (400-499)
- Topic: 444 - Encoder and Decoder
- Replies: 155
- Views: 44550
- Tue Oct 06, 2009 6:50 pm
- Forum: Volume 104 (10400-10499)
- Topic: 10473 - Simple Base Conversion
- Replies: 46
- Views: 21187
Re: 10473 - Simple Base Conversion
hello, below is a very simple code of this problem.it provides the correct output for smaller numbers but not for big numbers.can
any one tell me why it is happening?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
char num[100],*p;
while(1)
{
gets(num);
n = atoi(num);
if ...
any one tell me why it is happening?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
char num[100],*p;
while(1)
{
gets(num);
n = atoi(num);
if ...
- Tue Sep 15, 2009 9:28 am
- Forum: Volume 115 (11500-11599)
- Topic: 11530 - SMS Typing
- Replies: 41
- Views: 16437
Re: 11530 - SMS Typing
#include <stdio.h>
int main()
{
int test;
char str[100];
scanf("%d",&test);
//fflush(stdin);
for(int i=0;i<test;i++)
{
gets(str);
int j=0,count=0;
while(str[j]!='\0')
{
if(str[j]==' ')count+=1;
else if(str[j]=='a' || str[j]=='d' || str[j] == 'g' || str[j] =='j' || str[j]=='m' || str ...
int main()
{
int test;
char str[100];
scanf("%d",&test);
//fflush(stdin);
for(int i=0;i<test;i++)
{
gets(str);
int j=0,count=0;
while(str[j]!='\0')
{
if(str[j]==' ')count+=1;
else if(str[j]=='a' || str[j]=='d' || str[j] == 'g' || str[j] =='j' || str[j]=='m' || str ...
- Fri Apr 03, 2009 9:07 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10168 - Summation of Four Primes
- Replies: 51
- Views: 29878
Re: 10168 - Summation of Four Primes
#include <stdio.h>
#include <math.h>
int prime(int n)
{
int i = 3 , j=0;
if(n%2==0 && n!=2)return 0;
if(n==2)return 1;
for(;i <= sqrt(n) ; i+=2)
{
if( (n%i)==0 ) return 0;
else j=1;
}
if(j==1)return 1;
}
void print(int n)
{
int i;
for( i=2 ; i <= n/2 ;i++)
{
if(prime(i))
{
if ...
#include <math.h>
int prime(int n)
{
int i = 3 , j=0;
if(n%2==0 && n!=2)return 0;
if(n==2)return 1;
for(;i <= sqrt(n) ; i+=2)
{
if( (n%i)==0 ) return 0;
else j=1;
}
if(j==1)return 1;
}
void print(int n)
{
int i;
for( i=2 ; i <= n/2 ;i++)
{
if(prime(i))
{
if ...
- Fri Apr 03, 2009 9:04 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10168 - Summation of Four Primes
- Replies: 51
- Views: 29878
Re: 10168 - Summation of Four Primes
#include <stdio.h>
#include <math.h>
int prime(int n)
{
int i = 3 , j=0;
if(n%2==0 && n!=2)return 0;
if(n==2)return 1;
for(;i <= sqrt(n) ; i+=2)
{
if( (n%i)==0 ) return 0;
else j=1;
}
if(j==1)return 1;
}
void print(int n)
{
int i;
for( i=2 ; i <= n/2 ;i++)
{
if(prime(i))
{
if ...
#include <math.h>
int prime(int n)
{
int i = 3 , j=0;
if(n%2==0 && n!=2)return 0;
if(n==2)return 1;
for(;i <= sqrt(n) ; i+=2)
{
if( (n%i)==0 ) return 0;
else j=1;
}
if(j==1)return 1;
}
void print(int n)
{
int i;
for( i=2 ; i <= n/2 ;i++)
{
if(prime(i))
{
if ...