Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
17 views
6 pages
Tol Lab
tol lab
Uploaded by
mamane bello
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Download
Save
Save TOL LAB For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
17 views
6 pages
Tol Lab
tol lab
Uploaded by
mamane bello
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save TOL LAB For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save TOL LAB For Later
You are on page 1
/ 6
Search
Fullscreen
1: //Check if a given string has even a or not.
Make sure that string is made up of on
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,a,c=0,f=0;
8: char A[50];
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: for(i=0;i<strlen(A);i++)
12: {
13: if(A[i]=='a')
14: {
15: c=c+1;
16: }
17: }
18: if(c%2==0)
19: {
20: printf("\nThe Given string have even number of a's ");
21: }
22: else
23: {
24: printf("\nThe Given string not have even number of a's ");
25: }
26:
27: for(i=0;i<strlen(A);i++)
28: {
29: if(A[i]=='a'|| A[i]=='b')
30: {
31: f=f;
32: }
33: else
34: {
35: f=1;
36: }
37: }
38: if(f==1)
39: {
40: printf("\nThe string also contains other than a and b.");
41: }
42: else
43: {
44: printf("\nThe string is made up of only a and b.");
45: }
46: return 0;
47: }
1: //Check if a given string has even a and odd b. String should made up of only a and
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,a,ac=0,bc=0,f=0;
8: char A[50];
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: for(i=0;i<strlen(A);i++)
12: {
13: if(A[i]=='a')
14: {
15: ac=ac+1;
16: }
17: if(A[i]=='b')
18: {
19: bc=bc+1;
20: }
21: }
22: if(ac%2==0&&bc%2==0)
23: {
24: printf("\nThe Given string have even number of a's and b's");
25: }
26: else if(ac%2==0&&bc%2!=0)
27: {
28: printf("\nThe Given string have even number of a's and odd number of b's");
29: }
30: else if(ac%2!=0&&bc%2!=0)
31: {
32: printf("\nThe Given string have odd number of a's and b's");
33: }
34: else
35: {
36: printf("\nThe Given string have odd number of a's and even number of b's");
37: }
38:
39: for(i=0;i<strlen(A);i++)
40: {
41: if(A[i]=='a'|| A[i]=='b')
42: {
43: f=f;
44: }
45: else
46: {
47: f=1;
48: }
49: }
50: if(f==1)
51: {
52: printf("\nThe string also contains other than a and b.");
53: }
54: else
55: {
56: printf("\nThe string is made up of only a and b.");
57: }
58: return 0;
59: }
1: //Check if a sting over 0 and 1 ends with 0.
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,a,f=0,n;
8: char A[50];
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: n=strlen(A);
12: for(i=0;i<strlen(A);i++)
13: {
14: if(A[i]=='0'|| A[i]=='1')
15: {
16: f=f;
17: }
18: else
19: {
20: f=1;
21: }
22: }
23: if(A[n-1]=='0'&&f==0)
24: {
25: printf("\n\nThe given string is over 0 and 1 ends with 0");
26: }
27: else if(A[n-1]!='0'&&f==0)
28: {
29: printf("\n\nThe given string is over 0 and 1 not ends with 0");
30: }
31: else
32: {
33: printf("\n\nThe given string is not over 0 and 1 only it also contains other than 0 and
34: }
35: return 0;
36: }
37:
1: //Check if a given string is a valid integer.
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,j,a,f1=0,f2=0,n;
8: char A[50],D[20]="+-0123456789";
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: for(i=0;i<strlen(D);i++)
12: {
13: if(A[0]==D[i])
14: {
15: f1=1;
16: }
17: }
18: if(f1==1)
19: {
20: for(i=1;i<strlen(A);i++)
21: {
22: f2=0;
23: for(j=2;j<strlen(D);j++)
24: {
25: if(A[i]==D[j])
26: {
27: f2=1;
28: }
29: }
30: if(f2==0)
31: {
32: printf("\nInvalid Integer String\n");
33: break;
34: }
35: }
36: if(f2==1)
37: {
38: printf("\nValid Integer String\n");
39: }
40: }
41: else
42: {
43: printf("\nInvalid Integer String\n");
44: }
45: return 0;
46: }
47:
1: //Check if a given string is a valid identifier.
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,j,a,f1=0,f2,n;
8: char A[50],D[70]="abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVXXYZ_",D2[60]="_
9: printf("Enter the string\n");
10: //scanf("%s",&A);
11: gets(A);
12: printf("%s",A);
13: for(i=0;i<strlen(D2);i++)
14: {
15: if(A[0]==D2[i])
16: {
17: f1=1;
18: }
19: }
20: if(f1==1)
21: {
22: for(i=1;i<strlen(A);i++)
23: {
24: f2=0;
25: for(j=0;j<strlen(D);j++)
26: {
27: if(A[i]==D[j])
28: {
29: f2=1;
30: }
31: }
32: if(f2==0)
33: {
34: printf("\nInvalid Identifier.. \n");
35: break;
36: }
37: }
38: if(f2==1)
39: {
40: printf("\nValid Identifier.. \n");
41: }
42: }
43: else
44: {
45: printf("\nInvalid Identifier..\n");
46: }
47: return 0;
48: }
49:
50:
1: //Check if a string over a and b is a palindrome.
2: #include<stdio.h>
3: #include<conio.h>
4: #include<string.h>
5: int main()
6: {
7: int i,a,f1=0,f2=0,n,m;
8: char A[50];
9: printf("Enter the string\n");
10: scanf("%s",&A);
11: for(i=0;i<strlen(A);i++)
12: {
13: if(A[i]=='a'|| A[i]=='b')
14: {
15: f1=f1;
16: }
17: else
18: {
19: f1=1;
20: }
21: }
22: m=strlen(A)/2;
23: n=strlen(A)-1;
24: for(i=0;i<m;i++)
25: {
26: if(A[i]!=A[n-i])
27: {
28: f2=1;
29: }
30: }
31: if(f1==1&&f2==0)
32: {
33: printf("\nThe string also contains other than a and b. It creates palindrome.\n");
34: }
35: else if(f1==0&&f2==1)
36: {
37: printf("\nThe string is made up of only a and b. It Not Creates palindrome.\n");
38: }
39: else if(f1==0&&f2==0)
40: {
41: printf("\nThe string is made up of only a and b. It Creates palindrome.\n");
42: }
43: else
44: {
45: printf("\nInvalid string\n");
46: }
47: return 0;
48: }
You might also like
មេរៀនទី 04 Control Structure
PDF
No ratings yet
មេរៀនទី 04 Control Structure
12 pages
OUTPUT BASED QUESTIONS-Sheet-1
PDF
No ratings yet
OUTPUT BASED QUESTIONS-Sheet-1
7 pages
University of Calcutta: Programming Through C Language and HTML
PDF
No ratings yet
University of Calcutta: Programming Through C Language and HTML
35 pages
Formal Language and Automata Theory Lab Practicals
PDF
No ratings yet
Formal Language and Automata Theory Lab Practicals
34 pages
CD Lab File 1-9 888
PDF
No ratings yet
CD Lab File 1-9 888
36 pages
Lab Manual Compiler Lab: Viii Sem Btech (Cse/It)
PDF
No ratings yet
Lab Manual Compiler Lab: Viii Sem Btech (Cse/It)
51 pages
61 Assignment5
PDF
No ratings yet
61 Assignment5
3 pages
Lab 2
PDF
No ratings yet
Lab 2
9 pages
Lab Report
PDF
No ratings yet
Lab Report
32 pages
All Document Reader 1729225123806
PDF
No ratings yet
All Document Reader 1729225123806
69 pages
Comment or Not
PDF
No ratings yet
Comment or Not
23 pages
Dsaf
PDF
No ratings yet
Dsaf
31 pages
Prog
PDF
No ratings yet
Prog
4 pages
Data Structures Laboratory-Bcsl305
PDF
No ratings yet
Data Structures Laboratory-Bcsl305
64 pages
Trail DC
PDF
No ratings yet
Trail DC
33 pages
Maths
PDF
No ratings yet
Maths
20 pages
Compiler Design Labs
PDF
No ratings yet
Compiler Design Labs
25 pages
Problem Solving and Programming
PDF
No ratings yet
Problem Solving and Programming
13 pages
Os Lab
PDF
No ratings yet
Os Lab
27 pages
CD Lab Answers
PDF
No ratings yet
CD Lab Answers
19 pages
C Assignment All
PDF
No ratings yet
C Assignment All
14 pages
Program & Output Without Result
PDF
No ratings yet
Program & Output Without Result
89 pages
Exp 06
PDF
No ratings yet
Exp 06
4 pages
EXP1
PDF
No ratings yet
EXP1
6 pages
Compiler Design
PDF
No ratings yet
Compiler Design
51 pages
DS LAB MANUAL - Deepa
PDF
No ratings yet
DS LAB MANUAL - Deepa
42 pages
Dsa Manual SH
PDF
No ratings yet
Dsa Manual SH
50 pages
CD Lab
PDF
No ratings yet
CD Lab
27 pages
Program 1-7
PDF
No ratings yet
Program 1-7
21 pages
Indira Gandhi Delhi Technical University For Women
PDF
No ratings yet
Indira Gandhi Delhi Technical University For Women
29 pages
Assignment 11
PDF
No ratings yet
Assignment 11
8 pages
C Spiral2021
PDF
No ratings yet
C Spiral2021
74 pages
DS Lab Mannual
PDF
No ratings yet
DS Lab Mannual
57 pages
CD Lab Programs
PDF
No ratings yet
CD Lab Programs
43 pages
I)
PDF
No ratings yet
I)
5 pages
DS Lab Programs - RK
PDF
No ratings yet
DS Lab Programs - RK
31 pages
C Programs (Basics) For Beginners
PDF
No ratings yet
C Programs (Basics) For Beginners
9 pages
CD Programs PDF
PDF
No ratings yet
CD Programs PDF
18 pages
All C Programs Database
PDF
No ratings yet
All C Programs Database
13 pages
Workshop03 TranNhatMinh HE186799
PDF
No ratings yet
Workshop03 TranNhatMinh HE186799
28 pages
Assignment 3
PDF
No ratings yet
Assignment 3
10 pages
Ossem 5
PDF
No ratings yet
Ossem 5
102 pages
Tanya Toc Assignment
PDF
100% (1)
Tanya Toc Assignment
52 pages
CD Lab5
PDF
No ratings yet
CD Lab5
6 pages
C Programming Exercise
PDF
No ratings yet
C Programming Exercise
4 pages
CD Lab Manual
PDF
No ratings yet
CD Lab Manual
37 pages
Psap CP My Codes
PDF
No ratings yet
Psap CP My Codes
24 pages
Data Structures Lab Programs Fibonacci
PDF
No ratings yet
Data Structures Lab Programs Fibonacci
53 pages
DSA Programs
PDF
No ratings yet
DSA Programs
20 pages
CD Lab Manual
PDF
No ratings yet
CD Lab Manual
71 pages
Subjective Assignment 03 Ifelse Ans
PDF
No ratings yet
Subjective Assignment 03 Ifelse Ans
13 pages
Lab 9
PDF
No ratings yet
Lab 9
3 pages
PST Programs
PDF
No ratings yet
PST Programs
14 pages
CD Lab
PDF
No ratings yet
CD Lab
36 pages
Pasap Important Questions
PDF
No ratings yet
Pasap Important Questions
38 pages
Lab Final (Spring - 2022) : CSE - 112 Structured Programming Language
PDF
No ratings yet
Lab Final (Spring - 2022) : CSE - 112 Structured Programming Language
7 pages
English Lab Book PDF
PDF
No ratings yet
English Lab Book PDF
11 pages
Name:-Manvi Gour Branch: - AIDS CODE: - #Include
PDF
No ratings yet
Name:-Manvi Gour Branch: - AIDS CODE: - #Include
6 pages
Os Lab Assignment-1: FCFS Process Scheduling
PDF
No ratings yet
Os Lab Assignment-1: FCFS Process Scheduling
7 pages
C Programs
PDF
No ratings yet
C Programs
21 pages
C Program To Find Maximum Between Two Numbers
PDF
No ratings yet
C Program To Find Maximum Between Two Numbers
14 pages
Fa19 BCS 139 Dsa LS1
PDF
No ratings yet
Fa19 BCS 139 Dsa LS1
2 pages
String Exercise - C Programming
PDF
No ratings yet
String Exercise - C Programming
8 pages
CD Lab Manual - Word
PDF
No ratings yet
CD Lab Manual - Word
42 pages
Wa0001 PDF
PDF
No ratings yet
Wa0001 PDF
7 pages
Output:-: 1. //wap To Print Simple Message
PDF
No ratings yet
Output:-: 1. //wap To Print Simple Message
82 pages
Assignment Input Output
PDF
No ratings yet
Assignment Input Output
29 pages
Lab3 2023103623
PDF
No ratings yet
Lab3 2023103623
12 pages
Snake Game Source Code in C
PDF
No ratings yet
Snake Game Source Code in C
9 pages
Compiler Lab Report, DIU
PDF
No ratings yet
Compiler Lab Report, DIU
13 pages
CD Lab Manual Final
PDF
No ratings yet
CD Lab Manual Final
51 pages
LAB Manual: School of Engineering and Technology
PDF
No ratings yet
LAB Manual: School of Engineering and Technology
33 pages
Computer Graphics Assignment - 6: Write A Program To Implement NLN Line Clipping Algorithm
PDF
No ratings yet
Computer Graphics Assignment - 6: Write A Program To Implement NLN Line Clipping Algorithm
10 pages
ADA Practical File: Kartik Kataria
PDF
No ratings yet
ADA Practical File: Kartik Kataria
34 pages
Compiler Design: Department of Computer Science & Faculty of Engineering
PDF
No ratings yet
Compiler Design: Department of Computer Science & Faculty of Engineering
27 pages
CD 1
PDF
No ratings yet
CD 1
18 pages
Write A Program in C To Check Whether A Entered Number Is Positive, Negative or Zero
PDF
No ratings yet
Write A Program in C To Check Whether A Entered Number Is Positive, Negative or Zero
10 pages
Write A C Program To Find Out Largest Element of An Array
PDF
No ratings yet
Write A C Program To Find Out Largest Element of An Array
8 pages
Cafeteria Code
PDF
No ratings yet
Cafeteria Code
9 pages
The VTU Blogger: Data Structures Lab Programs
PDF
No ratings yet
The VTU Blogger: Data Structures Lab Programs
40 pages
Lab1 (1) Compiler
PDF
No ratings yet
Lab1 (1) Compiler
4 pages
Compiler Design Lab
PDF
No ratings yet
Compiler Design Lab
18 pages
Neopat Technical Week 3
PDF
No ratings yet
Neopat Technical Week 3
6 pages
Advanced C - Programs With Solutions
PDF
No ratings yet
Advanced C - Programs With Solutions
7 pages
Experiment - 1: Aim: Write A C Program To Design Lexical Analyzer Which Will Identify Keywords, Identifiers, Source Code
PDF
No ratings yet
Experiment - 1: Aim: Write A C Program To Design Lexical Analyzer Which Will Identify Keywords, Identifiers, Source Code
5 pages
Practical File: Department of Computer Science and Engineering
PDF
No ratings yet
Practical File: Department of Computer Science and Engineering
32 pages
Polynomial Addition & Doubly Linked List
PDF
No ratings yet
Polynomial Addition & Doubly Linked List
8 pages
Patterns Using C
PDF
No ratings yet
Patterns Using C
6 pages
Name: Mishra Bhaskar Anupam Enroll: 14012141016 Class: 6th ME B Program For "FORCED CONVECTION"
PDF
No ratings yet
Name: Mishra Bhaskar Anupam Enroll: 14012141016 Class: 6th ME B Program For "FORCED CONVECTION"
10 pages