Home » Printing Strong Numbers in the given Range | C Language Tutorial | Mr. Srinivas naresh i technology c language

Printing Strong Numbers in the given Range | C Language Tutorial | Mr. Srinivas naresh i technology c language



Printing Strong Numbers in the given Range
C Language Tutorial Videos | Mr. Srinivas
** For Online Training Registration: ? Call: +91-8179191999

? Visit Our Website for Classroom Training:

? For Online Training:

————————–

? About NareshIT:

“Naresh IT is having 14+ years of experience in software training industry and the best Software Training Institute for online training, classroom training, weekend training, corporate training of Hadoop, Salesforce, AWS, DevOps, Spark, Data Science, Python, Tableau, RPA ,Java, C#.NET, ASP.NET, Oracle, Testing Tools, Silver light, Linq, SQL Server, Selenium, Android, iPhone, C Language, C++, PHP and Digital Marketing in USA,Hyderabad, Chennai and Vijayawada,Bangalore India which provides online training across all the locations

See also  Best HARD DRIVES For Video Editing & Storage! g technology g drive setup

————————–

? Our Online Training Features:
1.Training with Real-Time Experts
2.Industry Specific Scenario’s
3.Flexible Timings
4.Soft Copy of Material
5. Share Videos of each and every session.

————————–

Please write back to us at [email protected]/[email protected] or Call us at USA:

See also  Top 10 Cool Tech & Gadget Under $25 on Amazon technology gadget

+1404-232-9879 or India: +918179191999

** Check The Below Links**
? For Course Reg:
? Subscribe to Our Channel:
? Circle us on G+:
? Like us on Facebook:
? Follow us on Twitter:
? Follow us on Linkedin:

? Follow us on Instagram: .

Images related to the topic naresh i technology c language

Printing Strong Numbers in the given Range | C Language Tutorial | Mr. Srinivas

Printing Strong Numbers in the given Range | C Language Tutorial | Mr. Srinivas

Search related to the topic Printing Strong Numbers in the given Range | C Language Tutorial | Mr. Srinivas

#Printing #Strong #Numbers #Range #Language #Tutorial #Srinivas
Printing Strong Numbers in the given Range | C Language Tutorial | Mr. Srinivas
naresh i technology c language
See all the latest ways to make money online: See more here
See all the latest ways to make money online: See more here

39 thoughts on “Printing Strong Numbers in the given Range | C Language Tutorial | Mr. Srinivas naresh i technology c language”

  1. #include <stdio.h>

    void main()
    {
    int n,i,j,rem,temp;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
    temp=i;
    int sum=0;
    while(temp>0)
    {
    int fact=1;
    rem=temp%10;
    for(j=rem;j>0;j–)
    {
    fact*=j;
    }
    sum+=fact;
    temp=temp/10;
    }
    if(i==sum)
    printf("%dn",i);
    }
    }

  2. /*strong number in given range*/

    #include <stdio.h>

    int main()
    {
    long int limit,r,n,temp,fact,i,sum=0;
    printf("enter the value of the limit=");
    scanf("%ld",&limit);

    for(n=1;n<=limit;n++)
    {
    sum=0;
    temp=n;
    while(n>0)
    {
    r=n%10;
    fact=1;
    for(i=r; i>=1;i–)
    {
    fact=fact*i;
    }
    sum=fact+sum;
    n=n/10;
    }
    n=temp;
    if(n==sum)
    {
    printf("strong numbers in given range are =%ld n",n);
    }

    }

    return 0;
    }

  3. there is a mistake in the code.
    it should be like this
    //printing strong number in the given range….strong number:(sum of the idividual factorial of individual digits is called strong number)

    #include<stdio.h>

    void main()

    {

    int sum=0,fact=1,r=0,temp,limit;

    printf("enter lmit:");

    scanf("%d",&limit);

    for(int n=1;n<=limit;n++)

    { temp=n;

    while(n>0)

    {

    r=n%10;

    if(r!=0)

    {

    while(r!=0)

    {

    fact=fact*r;

    r–;

    }

    sum=sum+fact;

    }

    fact=1;

    n=n/10;

    }

    n=temp;

    if(n==sum)

    {

    printf("%d ",sum);

    }

    sum=0;

    }

    }

  4. #include<stdio.h>
    int main()
    {

    int fact,i,n,sum,r,temp,start,end;
    printf("enter rangen");
    scanf("%d %d",&start,&end);
    for(n=start;n<=end;n++)
    { sum=0;
    temp=n;
    while(n>0)
    { fact=1;
    r=n%10;
    for(i=r;i>=1;i–)
    {
    fact=fact*i;
    }
    sum=sum+fact;
    n=n/10;
    }
    n=temp;
    if(n==sum)
    printf("%d ",n);

    }
    }
    // strong numbers in the given range

  5. Here is the complete code:
    #include<stdio.h>
    main()
    {

    int n,r,sum=0,i,t, temp;
    printf("enter the value of n");
    scanf("%d",&n);
    temp=n;
    while(n>0)
    {
    r=n%10;
    t=r;
    n=n/10;
    for(i=1;i<t;i++)
    {
    r=r*i;
    }
    sum=sum+r;
    }
    if(sum==temp)
    printf("it is a strong number");

    else
    printf("it is not");
    }

  6. solution:-
    #include<stdio.h>

    void main()

    {

    int limit,n,i,r,sum,fact,tmp;

    printf("enter the limits=");

    scanf("%d",&limit);

    for(n=1;n<=limit;n++)

    {

    sum = 0;

    tmp = n;

    while(n>0)

    {

    r=n%10;

    fact=1;

    for(i=r;i>=1;i–)

    {

    fact=fact*i;

    }

    sum=sum+fact;

    n=n/10;

    }

    n=tmp;

    if(n==sum)

    {

    printf("%d is strong numbern",n);

    }else

    {

    printf("%d is not the strong numbern",n);

    }

    }

    }

    if we put the limit=145 then it will give strong number between 1 to 145.

  7. here is the correct program
    //program to check whether a number is a strong number or not in a given limit

    #include <stdio.h>

    main()

    {

    int n, r, i, sum, fact, k, limit;

    printf("Enter a value: ");

    scanf("%d", &limit);

    for(n=1; n<=limit; n++)

    {

    sum = 0;

    k=n;

    while(k>0)

    {

    r=k%10;

    k=k/10;

    fact = 1;

    for(i=1; i<=r; i++)

    {

    fact = fact*i;

    }

    sum = sum + fact;

    }

    if(sum == n)

    {

    printf("%d is a strong numbern", n);

    }

    else

    {

    printf("%d is not a strong numbern", n);

    }

    }

    }

  8. int main()
    {
    int r,n,fact,sum=0,temp;
    printf("enter the valuen");
    scanf("%d",&n);
    temp=n;
    While(n>0)
    {
    r=n%10;
    fact=1;
    for(int i=r ; i>=1 ; i–)
    {
    fact=fact*i ;
    }
    sum=sum+fact ;
    n=n/10;
    }
    n=temp;
    if(n==sum)
    {
    printf("it's a strong numbern",n);
    }
    else
    printf ("nikal lavde");
    }
    Thinks should go positive from here

  9. The one who is reading my comment can run this program and tell me what's wrong with this program ?
    why does it give me wrong output ?
    #include<stdio.h>
    int main()
    {
    //declaring variables
    int re; //remainder
    int copy;
    int i; //counter
    int num;
    int fact; //factorial
    fact=1;
    int sum; //sum
    sum=0;
    //taking input
    printf("enter your number:n");
    scanf("%d",&num);
    copy=num; //storing the value of num to copy variable

    while(copy!=0)
    {
    re=copy%10;
    for(i=1;i<=re;i++);
    {
    fact=fact*i;

    }
    sum=sum+fact;
    fact=1;
    copy=copy/10;
    }
    if(sum==num)
    printf("%d is the strong numbern",num );
    else
    printf("%d is not strong numbern",num);
    return 0;
    }
    plz help me …

  10. HERE IS THE CODE FOR STRONG NUMBERS:
    #include<stdio.h>

    main()

    {

    int i,n,r,fact,sum=0,temp,limit;

    printf("enter the limit ");

    scanf("%d",&limit);

    for(n=1;n<=limit;n++)

    {

    temp=n;

    sum=0;

    while(n>0)

    {

    fact=1;

    r=n%10;

    for(i=1;i<=r;i++)

    {

    fact=fact*i;

    }

    sum=sum+fact;

    n=n/10;

    }

    n=temp;

    if(sum==n)

    {

    printf("%d strong number n",n);

    } else

    {

    printf("%d not a strong numbern",n);

    }

    }

    }//your welcome

  11. FOR ALL THOSE WHO ARE FACING PROBLEM IN THIS CODE
    THIS IS THE CORRECT CODE FOR THIS PROGRAM:

    #include <stdio.h>

    #include <conio.h>

    int main()

    {

    long int n, limit, r, i, temp, fact, sum=0;

    printf("Enter the limit:");

    scanf("%ld", &limit);

    for(n=1; n<=limit; n++)

    {

    temp=n;

    sum=0;

    while(n>0)

    {

    r=n%10;

    fact=1;

    for(i=r; i>=1; i–)

    {

    fact=fact*i;

    }

    sum=sum+fact;

    n=n/10;

    }

    n=temp;

    if(n==sum)

    {

    printf("%ld is a strong numbern", n);

    }

    }

    getch();

    }

    FIRST COPY – PASTE THE ABOVE CODE AND TRY IN YOUR IDE
    SURELY IT WOULD WORK.

  12. here's the solution(with correction):-

    #include<stdio.h>
    #include<conio.h>
    void main()
    {
    long int i,j,range,index,sum=0,fact=1,temp;
    clrscr();
    printf("Enter any number here:");
    scanf("%ld",&range);
    for(i=1;i<=range;i++)
    {
    temp=i;
    sum=0;
    while(temp!=0)
    {
    fact=1;
    index=temp%10;
    for(j=1;j<=index;j++)
    {
    fact=fact*j;
    }
    temp=temp/10;
    sum=sum+fact;
    }

    if(sum==i)
    {
    printf("%ldn",i);
    }
    }
    getch();
    }

    I've tried it so many times and it giving me the perfect and correct result. So you've to try it too.

  13. I've just stored the i's value in temp var where i stores its value in temp and used temp to prevent loop infinite occurrence. and temp gets reset everytime when loop starts from beginning. That's all. The snippet is in the next comment.

  14. # include <stdio.h>
    # include <stdlib.h>

    int fact(int n) {
    int k, f = 1;
    for (k = 1; k <= n; k++) {
    f = f * k;
    }
    return f;
    }

    int main(int argc, char** argv) {

    long low, up, i, temp, sum, numbers[100];
    int strong, factoriel, rem;

    printf("Enter lower limit!n");
    scanf("%ld", &low);
    printf("Enter upper limit!n");
    scanf("%ld", &up);

    for (i = low; i <= up; i++) {
    sum = 0;
    temp = i;
    while (temp > 0) {
    rem = temp % 10;
    factoriel = fact(rem);
    sum = sum + factoriel;
    temp = temp / 10;
    }
    if(sum == i){
    numbers[strong] = i;
    strong++;
    }
    }
    if(strong == 0)
    printf("nNo strong numbers between %ld and %ldn", low, up);
    else{
    printf("nStrong numbers between %ld and %ld are :nn", low, up);
    for(i = 0; i < strong; i++)
    printf("numbers[%ld] je %ldn", i, numbers[i]);
    }

    return (EXIT_SUCCESS);
    }

  15. #include<stdio.h>
    void main()
    {
    int limit,n,r,fact,i,temp,sum=0;
    printf("Enter limit");
    scanf("%d",&limit);
    for(n=1;n<=limit;n++)
    {temp=n;
    sum=0;

    while(n>0)
    {
    r=n%10;
    fact=1;
    for(i=r;i>=1;i–)
    {
    fact=fact*i;
    }
    sum=sum+fact;
    n=n/10;

    }
    n=temp;
    if(sum==n)
    {
    printf(" %d is strong no n",n);
    }

    }
    }

Leave a Reply

Your email address will not be published.