- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
7 Posted Topics
Hi All, I am writing a program to find the number between 1 and 100 that has the greatest number of distinct divisors. Below is my code for the same. It is returning an erroneous answer, i.e. 8 for greatest number of distinct divisors and 4 as the number for … | |
Hi all, I have written a program to find the reciprocal of an input number by using newton rhapson iterative method. Below is the algorithm implementation in C: #include<stdio.h> #include<stdlib.h> #include<math.h> int main() { double guess,newguess,input,error=1.0; printf("Enter the input number"); scanf("%f",&input); printf("Enter the guess for the reciprocal of the input … | |
Dear All, I have written a program to find the smallest divisor of an input number. The code gives me an error in lines 19 and 23. The error is invalid operands to binary %. Please help me to troubleshoot, thank you. Below is my code: #include<stdio.h> #include<stdlib.h> #include<math.h> int … | |
Dear All, I have written a program that finds the integer whose square is closest to but greater than the integer number input as data. But it is giving me an erroneous answer. My algorithm is: 1. Select a number which is half the input number. 2. Square it and … | |
Hi All, I have written a program to input a decimal string and convert it to character string. Below is my program: /*this program converts the decimal representation of an input string to character representation*/ #include<math.h> #include<stdio.h> #include<stdlib.h> char int2str(int n); int main() { int dec[100]={0},i,j,decindex,ndec=0,nchar; char character[100]={'\0'}; printf("Enter the … | |
Dear All, I have written a program which converts an input decimal number into any number in a base between 2 and 36. Below is my program: #include<stdio.h> #include<stdlib.h> int main() { int newbase,n,i,ascii,ndigit=0,q,r,zero; char newrep[100]; printf("Enter the number to be converted"); scanf("%d",&n); printf("Enter the base between 2 and 36 … | |
Dear All, I have written a code to implement an algorithm for base conversion from decimal to any base between 2 and 36 given in RG Dromey. Below is my code and I have a few questions relating to it: [CODE] #include<stdio.h> #include<stdlib.h> int main() { int newbase,zero=atoi(0),q,ndigit=0,r,ascii,i; char newrep[100]; … |
The End.