×
Everyone has a talent and so do you. Let it shine out, is all you have to do.
--Your friends at LectureNotes
Close

C Language

by Umesh KumarUmesh Kumar
Type: PracticalInstitute: Guru Ghasidas Viswavidhyalaya Specialization: Master of Computer ApplicationsOffline Downloads: 5Views: 106Uploaded: 1 month ago

Share it with your friends

Suggested Materials

Leave your Comments

Contributors

Umesh Kumar
Umesh Kumar
MCA I SEMETER LAB BOOK ON Programming language in c MCA I YEAR I SEMETER (SUBCOD-103) Mr. UMESH KUMAR, MCA DEPARTMENT OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGY GURU GHASIDAS VISHWAVIDYALAY,BILASPUR BILASPUR, (C.G), KONI, CHHATTISAGARH 495009
1. Write a program to reverse any integer number. #include<stdio.h> #include<conio.h> void main() { int n,rev =0; clrscr(); printf("Enter Any set of Number \n"); scanf("%d",&n); while(n!=0) { rev = rev * 10; rev = rev + n % 10; n=n/10; } printf("Reverse Number is = %d",rev); getch(); } 2. Write a program to display sum of digit of any given integer. (Eg. 1234, 1+2+3+4 output = 10 ) #include<stdio.h> #include<conio.h> void main() { int i,n,b,sum=0; clrscr(); printf("Enter any Number \n"); scanf("%d",&n); while(n>0) { b = n%10; sum = sum+b; n=n/10; } printf(" Sum of Digit =%d",sum); getch(); }
3. Write Fibonacci Series till 15. (0,1,1,2,3,5,8,13). #include<stdio.h> #include<conio.h> void main() { int n,a,b,c; n=15;//upper limit clrscr(); a=0; b=1; c=a+b; while(c<=n) { printf("%3d",c); c=a+b; a=b; b=c; } getch(); } 3. Write a program to print largest no. out of 3 no.(Using nested if statement). #include<stdio.h> #include<conio.h> void main() { int a,b,c; clrscr(); printf("\n Enter Three Number \n"); scanf("%d%d%d",&a,&b,&c); if(a>b && a>c) { printf(" A is largest number"); } else if(b>c && b>a) { printf("B is largest Number"); }
else if(c>b & c>a) { printf("\n C is largest number"); } else { printf("\n if big no eque show but not show smaller no"); } getch(); } 5. Write a program to check given no. is palindrome or not (User will enter no.). #include<stdio.h> #include<conio.h> void main() { long int n,r,b,rev; clrscr(); printf("Enter any Number::"); scanf("%ld",&n); b=n; rev=0; while(n!=0) { r=n%10; rev=rev*10+r; n=n/10; } printf("Reverse Number is =%d",rev); if(rev==b) printf("Its Polindrome Number"); else printf("Its not Polindrome Number"); getch(); }

Lecture Notes