Zoho Second round - adding a digit to all the digits of a number
Adding a digit to all the digits of a number eg digit=4, number = 2875, o/p= 612119
C Program:
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
int t,n,i=0;
char num[100];
printf("Enter the digit: ");
scanf("%d",&n);
printf("Enter the number: ");
scanf("%s",num);
printf("o/p ");
for(i=0;i<strlen(num);i++)
{
printf("%d",num[i]-'0'+n);
}
getch();
return 0;
}
Comments
Post a Comment