![Quote](https://cboard.cprogramming.com/images/misc/quote_icon.png)
Originally Posted by
sunnypalsingh
Well This should be in C forum not in c++...anyways here is the working code....though its printing in reverse order...make some changes yourself
Code:
#include <stdio.h>
int main()
{
int num;
printf("Enter a five-digit number:");
scanf("%d",&num);
while(num>0)
{
printf("%4d",num%10);
num/=10;
}
return 0;
}
i did like this:
Code:
#include <stdio.h>
int main()
{
int num;
printf("Enter a five-digit number:");
scanf("%d", &num);
printf("%d", num/10000);
printf(" ");
num=num%10000;
printf("%d", num/1000);
printf(" ");
num=num%1000;
printf("%d", num/100);
printf(" ");
num=num%100;
printf("%d", num/10);
printf(" ");
num=num%10;
printf("%d", num/1);
printf(" \n");
num=num%1;
return 0;
}
and it works well, thanks for your help also.
what about second one?
i begun like this
Code:
#include <stdio.h>
int main()
{
int sex,male,female,homeregion,yearofbirth,gpa;
printf("Enter sex (1:male, 2:female:");
scanf("%d",sex);
if(sex==1)
printf("male\n");
if(sex==2)
printf("female\n");
printf("Enter home region (1:Marmara,2:Agean,3:Mediterrenian,4:Central,5:Black Sea,6:Southeast,7:East");
scanf("%d",homeregion);
if(homeregion==1)
printf("Marmara\n");
if(homeregion==2)
printf("Agean\n");
if(homeregion==3)
printf("Mediterrenian\n");
if(homeregion==4)
printf("Central\n");
if(homeregion==5)
printf("Black Sea\n");
if(homeregion==6)
printf("Southeast\n");
if(homeregion==7)
printf("East\n");
if(homeregion==1)
bu i do not how to continue. could someone help guys.
prog-bman i beg your pardon, i'm new here.
*modedit nvoigt: fixed [ code ] blocks*