0) { b=a%10; sum= sum+b ; a=a/10; }">
ADDING
This presentation is the property of its rightful owner.
Sponsored Links
1 / 6

#include< stdio.h > #include< conio.h > #include< math.h > void main() { unsigned long int a; PowerPoint PPT Presentation


  • 96 Views
  • Uploaded on
  • Presentation posted in: General

ADDING DIGITS. #include< stdio.h > #include< conio.h > #include< math.h > void main() { unsigned long int a; int i,b,sum =0; clrscr (); printf ("enter a no. to add digits of"); scanf ("% lu",&a ); while(a>0) { b=a%10; sum= sum+b ; a=a/10; }

Download Presentation

#include< stdio.h > #include< conio.h > #include< math.h > void main() { unsigned long int a;

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Include stdio h include conio h include math h void main unsigned long int a

ADDING

DIGITS

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

unsigned long int a;

inti,b,sum=0;

clrscr();

printf("enter a no. to adddigits of");

scanf("%lu",&a);

while(a>0)

{

b=a%10;

sum=sum+b;

a=a/10;

}

printf(“sumof digits is %d",sum);

getch();

}


Include stdio h include conio h include math h void main unsigned long int a

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

unsigned long inta,rev=0;

int b;

clrscr();

printf("enter a no. to reverse");

scanf("%lu",&a);

while(a>0)

{

b=a%10;

rev=rev*10+b;

a=a/10;

}

printf("no. in reverse order%lu",rev);

getch();

}

REVERSE

DIGITS

TO CHECK WHETHER NO. IS SAME BEFORE & AFTER REVERSING:

Declare org,org=a,at last if(org==rev) printf(“same”); else printf(“different”);


Include stdio h include conio h include math h void main unsigned long int a

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

long int fact=1;

int a;

clrscr();

printf("enter a no. to find factorial of");

scanf("%d",&a);

fact=a;

for(a=a-1;a>1;a--)

{

fact=fact*a;

}

printf("factorial of no. is %ld",fact);

getch();

}

FACTORIAL


Include stdio h include conio h include math h void main unsigned long int a

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

inta,i;

clrscr();

printf("enter a no. to check prime or not");

scanf("%d",&a);

for(i=2;i<a;i++)

{

if((a%i)==0)

{

printf("number is not prime");

goto end;

}

}

printf("number is prime");

end:

getch();

}

PRIME

NUMBER


Include stdio h include conio h include math h void main unsigned long int a

#include<stdio.h>

#include<conio.h>

#include<math.h>

void main()

{

int a=0,b=1,sum,i,n;

clrscr();

printf("enter a no. of terms in fibbonacci series");

scanf("%d",&n);

printf("%d\t%d",a,b);

for(i=0;i<=n-2;i++)

{

sum=a+b;

printf("\t%d",sum);

a=b;

b=sum;

}

getch();

}

FIBBONACCI

SERIES


  • Login