Cute🥺-Maths🔢in C Language😎.
Example1:Cut a number into it's digit
#include<stdio.h>
void main()
{
//पहले n and m📢declare करो
int n,m;
//फ़िर,n variable में एक अंक डालो😌
printf("Enter a number:");
scanf("%d",&n);
while(n!=0)
{
//n mod(%) 10 से last digit☺️मिल जाता है
m=n%10;
//last digit छापिए🖨️
printf("%d\n",m);
// n/10 अर्थात् 45/10=4.5=4,int data type के वज़ह से point के बाद वाला digit कट जाता है 🤣
n=n/10;
}
}
/*Enter a number:356
6
5
3
[Process completed (code 2) - press Enter]*/
Example2: Reverse the digit of a number.
#include<stdio.h>
void main()
{
//पहले n and m📢declare करो
int n,m;
//फ़िर,n variable में एक अंक डालो😌
printf("Enter a number:");
scanf("%d",&n);
while(n!=0)
{
//n mod(%) 10 से last digit☺️मिल जाता है
m=n%10;
//last digit छापिए🖨️
printf("%d",m);
// n/10 अर्थात् 45/10=4.5=4,int data type के वज़ह से point के बाद वाला digit कट जाता है 🤣
n=n/10;
}
}
/*Enter a number:38392
29383
[Process completed (code 1) - press Enter]*/
Comments
Post a Comment