Hello!
I would like to ask you for help about this: Create a program in C that inputs a random number from the keyboard( long long ), finds the sum of the numbers formed by the digits, grouped in pairs
starting from the one and displays the character equivalent of the ASCII table, it
will meet the remainder of the division of 127.

For example:

Possible input:
123456 12+34+56 = 102 102%127=102 - The sybmol N 102 in ANCII is "f"

Recommended Answers

All 4 Replies

What kind of "help" are you looking for? Daniweb requires proof of effort for homework questions, and I don't see any such proof. Please give it an honest try, and feel free to ask for help (that doesn't constitute doing your work for you) if you get stuck.

Displaying the ascii value is simple -- just typecast it from int to char.

If you wanted to take in really long numbers ...

you could use a large char buffer

char buffer[256];

to take in the chars using fgets

Then easy to travese that buffer and extract pairs of numbers into an array of pairs

int pairs[100];

then process that array of integers

Thank you all for your help! This is what i have for now... :

#include <stdio.h> 
#include <stdlib.h> 
int main() 
{
int a,sum=0;
printf("Imput number: ");
scanf("%d",&a);
while(a!=0) 
{
sum+=a%100;
a/=100; 
}
sum%=127;
printf("\nThe sum is: %d\n",sum);
printf("The character equivalent of %d in ANCII is '%c'\n",sum,sum); 
return 0; 
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.