Write a program in C to check a number that’s it reversed is equal or not

#include<stdio.h>#include<math.h>int main(){ int n,a,b,num; long int r=0; printf(“n Enter a five dight number=or less than 32766”); scanf(“%d”,&n); num=n; a=n%10; n=n/10; r=r+a*10000L; a=n%10; n=n/10; r=r+a*1000; a=n%10; n=n/10; r=r+a*100; a=n%10; n=n/10; r=r+a*10; a=n%10; r=r+a; if(r==num) printf(“n Given no. andd its reverse are equal”); else printf(“n Given no. and its reversed no. are not equal”); return 0; }

Write a program in C to calculate the day on 1st Jan of any year

#include<stdio.h> #include<math.h>int main(){ int ld,fd,yr; long int nd,td; printf(“Enter year”); scanf(“%d”,&yr); nd=(yr-1)*365L; ld=(yr-1)/4-(yr-1)/100+(yr-1)/400; td=nd+ld; fd=td%7; if(fd==0) printf(“n Monday”); if(fd==1) printf(“n tuesday”); if(fd==2) printf(“n Wednesday”); if(fd==3) printf(” n Thrusday”); if(fd==4) printf(” n Friday”); if(fd==5) printf(” n Saturday”); if(fd==6) printf(” n Sunday”); return 0; }

You cannot copy content of this page

Scroll to Top