Sunday 28 June 2020
Sum of lower triangular program | C language
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Delete a number by given position from array program | C Language
Q : Write a program to delete an element from a given location of an array of integers.
Answer :
#include<stdio.h>
#include<conio.h>
#define MAX 50
/*============================
Girfa Student Help
Remove from array by given index
==============================*/
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Link List vs Array
Q :Define array and link list. Give one example for each showing its usage
Answer :
Define Link List
struct node
{
int data;
struct node *next;
}
int ar[5];
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Saturday 27 June 2020
Whatsapp button for website
Add whatsup button at bottom right side of your website.
Button will show when user scroll down because it can disturb your home page
opening view. When user will click on whatsapp button it will redirect to
whatsapp message mode to the given number.
<style>
/* ========= CSS
==========*/
.g-whatsapp {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
cursor: pointer;
}
</style>
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Friday 26 June 2020
Even number print using function
Q : Write a function in ‘C’ to print even numbers from 1 to 100.
Answer :
#include<stdio.h>
#include<conio.h>
/*============================
Girfa Student Help
print even no. 1-100 using function
==============================*/
void print();
void main()
{
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Paragraph input using scanf
Q : Write a ‘C’ program in which a scanf() function can read a complete paragraph of text.
Answer :
#include<stdio.h>
#include<conio.h>
/*============================
Girfa Student Help
Paragraph input using scanf
==============================*/
void main()
{
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Tuesday 23 June 2020
ABC Pattern
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Bootstrap Corousel
<html>
<head>
<title>Corousel</title>
<script src="jquery.min.js"></script>
<script src="transition.js"></script>
<script src="carousel.js"></script>
<link href="bootstrap.min.css" rel="stylesheet">
</head>
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Monday 22 June 2020
String Handling C Language
String
In C programming, a string is a sequence of one or more than
any characters terminated with a null character. In C language you can only
save string in one dimensional character array , no separate data type for
string like java or c#.
Declare a string
char str = "GIRFA";
G
|
I
|
R
|
F
|
A
|
\0
|
Compiler will create an array of 6 element one extra cell
for null character which is used to detect end of string.
Input/Output
char str[10];
printf("Enter
string>>");
scanf("%s", str);
for (i = 1; i<str[i] != '\0'; i++)
printf("%c", str[i]);
This example shows you input a string without space and
process each character.
char str[10];
printf("Enter
string>>");
gets(str);
puts(str);
This example shows how to input space and print using
library function.
C language compiler has reach variety of string handling
functions string.h library file. Some popular function examples are given
below.
1 strcpy
Copy a string into other
Declaration:
char *strcpy(char *dest, const char *src);
char far * _fstrcpy(char far *dest, const char far *src);
Remarks:
Copies
string src to dest, stopping after the terminating null character has
been
moved.
int main(void)
{
char string[10];
char *str1 = "abcdefghi";
strcpy(string, str1);
printf("%s\n", string);
return 0;
}
2. Strlen
Calculates
length of a string
Declaration:
size_t strlen(const char *s);
size_t far _fstrlen(const char far
*s);
Remarks:
strlen
calculates the length of s.
Return Value:
Returns
the number of characters in s, not counting the terminating null
character.
int main(void)
{
char *string = "Borland
International";
printf("%d\n", strlen(string));
return 0;
}
3. strcat
Appends
one string to another
Declaration:
char *strcat(char *dest, const char *src);
char far * far _fstrcat(char far *dest, const char far *src);
Remarks:
strcat
appends a copy of src to the end of dest. The length of the resulting
string
is strlen(dest) + strlen(src).
int main(void)
{
char destination[25];
char *blank = " ", *c = "C++", *turbo = "Turbo";
strcpy(destination, turbo);
strcat(destination, blank);
strcat(destination, c);
printf("%s\n", destination);
return 0;
}
4.strcmp
strcmp
compare two strings
Declaration:
int strcmp(const char *s1, const char*s2);
Remarks:
strcmp performs an unsigned
comparison of s1 to s2. _fstrcmp is the far
version.
Return Value:
These
routines return an int value that is
<
0 if s1 < s2
== 0 if s1 ==
s2
>
0 if s1 > s2
int main(void)
{
char *buf1 = "aaa", *buf2 = "bbb", *buf3 = "ccc";
int ptr;
ptr = strcmp(buf2, buf1);
if (ptr > 0)
printf("buffer
2 is greater than buffer 1\n");
else
printf("buffer
2 is less than buffer 1\n");
ptr = strcmp(buf2, buf3);
if (ptr > 0)
printf("buffer
2 is greater than buffer 3\n");
else
printf("buffer
2 is less than buffer 3\n");
return 0;
}
5. strrev
Reverses
all characters in s (except for the terminating null)
Declaration:
char *strrev(char *s);
char far * far _fstrrev(char far *s);
Remarks:
strrev
and _fstrrev changes all characters in a string to reverse order,
except
the terminating null character.
For
example, it would change
string\0
to
gnirts\0.)
Return Value:
strrev
returns a pointer to the reversed string.
int main(void)
{
char *string = "Borland
International";
printf("string
prior to strlwr: %s\n", string);
strlwr(string);
printf("string
after strlwr: %s\n", string);
return 0;
}
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Sunday 21 June 2020
File C Language
File
A computer file is a computer resource for recording data
discretely in a computer storage device. Just as words can be written to paper,
so can information be written to a computer file. Files can be edited and
transferred through the internet on that particular computer system.
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Saturday 20 June 2020
Sum of digit program C language
Q : Write a program to find the sum of the digits of a number.
Answer :
#include<stdio.h>
#include<conio.h>
/*##########################
Girfa Student Help
Sum of digits of a number
##########################*/
void main()
{
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Difference between = and == operator C Language
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Friday 19 June 2020
Prime number program 1 to 100
Q : Write a program to print all prime numbers from 1 to 100. Use nested loops, break or continue statement wherever necessary.
Answer :
#include<stdio.h>
#include<conio.h>
/*##########################
Girfa Student Help
Prime number 1 to 100
##########################*/
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Goto C Language
Goto Example C Language
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Wednesday 17 June 2020
Continue in C language
What are the uses of Continue
Continue statement is transfers execution control at the top
of the loop where the condition checks. All statements after continue skips.
The closing bracket of the loop does the same task. Continue statements should
always be inside of a condition i.e. if, otherwise you may face infinite loop.
Continue statement in C language I feel that the least useful feature.
Example :
#include<stdio.h>
#include<conio.h>
/*##########################
Girfa Student Help
Example of continue
##########################*/
A programmer and Founder of Girfa
IT Services, working from 2009.At Starting computer teaching was my full-time job but after 10 years of teaching I chose to programming as a full-time job and teaching become part-time. In real life, I am very lazy and I made it my coding style I always try to make a reusable component that’s my USP for programming which saves my time and extra working both.
Subscribe to:
Posts (Atom)