0

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"

4
Contributors
4
Replies
41
Views
3 Years
Discussion Span
Last Post by Pepp
0

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.

0

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

Edited by David W: fixed comments

1

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; 
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.