please help me with this questions
first one is:
"Write a program that inputs one five-digit number, separates the number into its individual digit and prints the digits separated from one another by three spaces each.[Hint: Use combinations of integer division and the remainder operation.]"
my code is like this:
Code:
#include <stdio.h>
int main()
{
int num;
printf("Enter a five-digit number:");
scanf("%d",&num);
printf("%d num/100000\n");
num=num%100000;
printf("%d num/10000\n");
num=num%10000;
printf("%d num/1000\n");
num=num%1000;
printf("%d num/100\n");
num=num%100;
printf("%d num/10\n");
num=num%10;
return 0;
}
but it does no work. what is the mistake please help.
and here is the secound one, this one i could not do. by the way its my first yeat of C++.
"Given a set of coded information about a student, write a program that prints this information on a single line. For example,
A male student, at age 17, from Black Sea region, has fair performance with a GPA of 2.58"
Coded information is as follows:
Sex: 1:male, 2:female
Home region: 1:Marmara, 2: Agean, 3:Mediterrenian, 4:Central, :Black Sea, 6:Southeast, 7:East
Year of birth: 1988
GPA: 3-4: good, 2-2.99: fair, 1-1.99: poor, 0-0.99:failing