{"id":26387315,"url":"https://github.com/fasilofficial/number-programs-in-c","last_synced_at":"2025-03-17T08:31:18.659Z","repository":{"id":182730651,"uuid":"668993652","full_name":"fasilofficial/number-programs-in-c","owner":"fasilofficial","description":"Collection of multiple number programs in C language","archived":false,"fork":false,"pushed_at":"2023-07-21T05:47:48.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-07-21T06:35:14.356Z","etag":null,"topics":["automorphic-numbers","c","cprogramming","duck-number","km-number","neon-number","number","number-programs","number-programs-in-c","palindrome","special-number","spy-number"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fasilofficial.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-21T05:10:10.000Z","updated_at":"2023-07-21T06:35:26.055Z","dependencies_parsed_at":"2023-07-21T06:45:24.670Z","dependency_job_id":null,"html_url":"https://github.com/fasilofficial/number-programs-in-c","commit_stats":null,"previous_names":["fasilofficial/number-programs-in-c"],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasilofficial%2Fnumber-programs-in-c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasilofficial%2Fnumber-programs-in-c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasilofficial%2Fnumber-programs-in-c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fasilofficial%2Fnumber-programs-in-c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fasilofficial","download_url":"https://codeload.github.com/fasilofficial/number-programs-in-c/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243999895,"owners_count":20381449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automorphic-numbers","c","cprogramming","duck-number","km-number","neon-number","number","number-programs","number-programs-in-c","palindrome","special-number","spy-number"],"created_at":"2025-03-17T08:31:16.513Z","updated_at":"2025-03-17T08:31:18.302Z","avatar_url":"https://github.com/fasilofficial.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# number-programs-in-c\nCollection of multiple number programs in C language\n\n1. Palindrom Number or Not\nA palindromic number is a number that remains the same when its digits are reversed.\n```\n#include \u003cstdio.h\u003e\nvoid main()\n{\n    int n, rev = 0;\n    printf(\"Enter a number: \");\n    scanf(\"%d\", \u0026n);\n    int m = n;\n    while (n != 0)\n    {\n        int d = n % 10;\n        rev = rev * 10 + d;\n        n /= 10;\n    }\n    if (rev == m)\n    {\n        printf(\"%d is a palindrome number\", m);\n    }\n    else\n    {\n        printf(\"%d is not a palindrome number\", m);\n    }\n}\n```\n```\nEnter a number: 1234321\n1234321 is a palindrome number\n```\n\n2. Spy Number or Not\nA number is said to be a Spy number if the sum of all the digits is equal to the product of all digits.\n```\n#include \u003cstdio.h\u003e\nvoid main()\n{\n    int n, sum = 0, product = 1;\n    printf(\"Enter a number: \");\n    scanf(\"%d\", \u0026n);\n    int m = n;\n    while (n != 0)\n    {\n        int d = n % 10;\n        sum += d;\n        product *= d;\n        n /= 10;\n    }\n    if (sum == product)\n    {\n        printf(\"%d is a spy number\", m);\n    }\n    else\n    {\n        printf(\"%d is not a spy number\", m);\n    }\n}\n```\n```\nEnter a number: 123\n123 is a spy number\n```\n\n3. Special Number or Not\nA number is said to be a Special number if the sum of digits plus product of digits is equal to the original number.\n```\n#include \u003cstdio.h\u003e\nvoid main()\n{\n    int n, sum = 0, product = 1;\n    printf(\"Enter a number: \");\n    scanf(\"%d\", \u0026n);\n    int m = n;\n    while (n != 0)\n    {\n        int d = n % 10;\n        sum += d;\n        product *= d;\n        n /= 10;\n    }\n    if (sum + product == m)\n    {\n        printf(\"%d is a special number\", m);\n    }\n    else\n    {\n        printf(\"%d is not a special number\", m);\n    }\n}\n```\n```\nEnter a number: 59\n59 is a special number\n```\n\n4. Harshad/Niven Number or Not\nHarshad number or Niven number is a positive integer which is divisible by the sum of its digits.\n```\n#include \u003cstdio.h\u003e\nvoid main()\n{\n    int n, sum = 0;\n    printf(\"Enter a number: \");\n    scanf(\"%d\", \u0026n);\n    int m = n;\n    while (n != 0)\n    {\n        int d = n % 10;\n        sum += d;\n        n /= 10;\n    }\n    if (m % sum == 0)\n    {\n        printf(\"%d is a Harshad/ Niven number\", m);\n    }\n    else\n    {\n        printf(\"%d is not a Harshad/ Niven number\", m);\n    }\n}\n```\n```\nEnter a number: 156\n156 is a Harshad/ Niven number\n```\n\n5. Duck Number or Not\nA Duck number is a positive number which has zeroes present in it.\n```\n#include \u003cstdio.h\u003e\nvoid main()\n{\n    int n, count = 0;\n    printf(\"Enter a number: \");\n    scanf(\"%d\", \u0026n);\n    int m = n;\n    while (n != 0)\n    {\n        int d = n % 10;\n        if (d == 0)\n        {\n            count++;\n        }\n        n /= 10;\n    }\n    if (count \u003e 0)\n    {\n        printf(\"%d is a duck number\", m);\n    }\n    else\n    {\n        printf(\"%d is not a duck number\", m);\n    }\n}\n```\n```\nEnter a number: 102\n102 is a duck number\n```\n\n6. Neon Number or Not\nA neon number is a number where the sum of digits of square of the number is equal to the number.\n```\n#include \u003cstdio.h\u003e\nvoid main()\n{\n    int n;\n    printf(\"Enter a number: \");\n    scanf(\"%d\", \u0026n);\n    int m = n, sum = 0;\n    n *= n;\n    while (n != 0)\n    {\n        int d = n % 10;\n        sum += d;\n        n /= 10;\n    }\n    if (sum == m)\n    {\n        printf(\"%d is a neon number\", m);\n    }\n    else\n    {\n        printf(\"%d is not a neon number\", m);\n    }\n}\n```\n```\nEnter a number: 9\n9 is a neon number\n```\n\n7. Automorphic Number or Not\nA number is called an automorphic number if and only if the square of the given number ends with the same number itself.\n```\n#include \u003cstdio.h\u003e\nvoid main()\n{\n    int n;\n    printf(\"Enter a number: \");\n    scanf(\"%d\", \u0026n);\n    int m = n, flag = 0, square = n * n;\n    while (n != 0)\n    {\n        int d = n % 10;\n        int d1 = square % 10;\n        if (d != d1)\n        {\n            flag = 1;\n        };\n        square /= 10;\n        n /= 10;\n    }\n    if (flag == 0)\n    {\n        printf(\"%d is an automorphic number\", m);\n    }\n    else\n    {\n        printf(\"%d is not an automorphic number\", m);\n    }\n}\n```\n```\nEnter a number: 25\n25 is an automorphic number\n```\n\n8. KM Number or Not\nA number is said to be a KM number or Special number, if the sum of factorials of the input number's every digit is equal to the same input number.\n```\n#include \u003cstdio.h\u003e\nvoid main()\n{\n    int n;\n    printf(\"Enter a number: \");\n    scanf(\"%d\", \u0026n);\n    int m = n, sum = 0;\n    while (n != 0)\n    {\n        int d = n % 10;\n        int fact = 1;\n        for (int i = 1; i \u003c= d; i++)\n            fact *= i;\n        sum += fact;\n        n /= 10;\n    }\n    if (sum == m)\n    {\n        printf(\"%d is a KM number\", m);\n    }\n    else\n    {\n        printf(\"%d is not a KM number\", m);\n    }\n}\n```\n```\nEnter a number: 145\n145 is a KM number\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffasilofficial%2Fnumber-programs-in-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffasilofficial%2Fnumber-programs-in-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffasilofficial%2Fnumber-programs-in-c/lists"}