C PROGRAM FOR 3 4 33 34 43 44
Consider the following I/O samples.
SAMPLE INPUT: 5
SAMPLE OUTPUT: 43
3 4 33 34 43 44 333 334 343 344 433 434 443 444 3333 3334 .........
for 1 - 3 ; 2 - 4 ; 7 - 333....
C PROGRAM:#include<stdio.h>int main()
{
int n,b=1,ans=0;
scanf("%d",&n);
printf("\n");
while(n)
{
if(n%2==1)
ans=ans+3*b;
else
ans=ans+4*b;
n=(n-1)/2;
b=b*10;
}
printf("%d",ans);
return 0;
}
OUTPUT:The given source code in C program "for 3 4 33 34" is short and simple to understand. The source code is well tested in DEV-C++ and is completely error free.If you have any feedback about this article and want to improve this, please comment in the comment section.
Comments
Post a Comment