Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
#include <stdio.h>
int main()
{
int a[50],sum=0,i,n;
float avg;
printf("enter the number of elements in the array:");
scanf("%d",&n);
printf("enter the elements:n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
sum=sum+a[i];
}
avg=sum/n;
printf("sum is %dn",sum);
printf("average is %fn",avg);
return (0);
}
LINEAR SEARCH
#include <stdio.h>
void main()
{
int i,num, search, found = 0, a[15];
printf("Enter the number of elements: ");
scanf("%d", &num);
printf("Enter the elements n");
for (i = 0; i < num; i++)
{
scanf("%d", &a[i]);
}
printf("Enter the element to be searched ");
scanf("%d", &search);
for (i = 0; i < num ; i++)
{
if (search == a[i] )
{
found = 1;
break;
}
}
if (found == 1)
printf("Element is present in the array at position %d",i+1);
else
printf("Element is not present in the arrayn");
}
STRING COMPARISON
#include <stdio.h>
#include<string.h>
int main()
{
char str1[20];
char str2[20];
int value;
printf("Enter the first string : ");
scanf("%s",str1);
printf("Enter the second string : ");
scanf("%s",str2);
value=strcmp(str1,str2);
if(value==0)
printf("strings are same");
else
printf("strings are not same");
return 0;
}
NUMBER PALINDROME
#include <stdio.h>
int main()
{
int r,n,sum=0,temp;
printf("enter the number =");
scanf("%d",&n);
temp=n;
while(n>0)
{
r=n%10;
sum=(sum*10)+r;
n=n/10;
}
if(temp==sum)
printf("palindrome number");
else
printf("not palindrome");
return 0;
}
STRING PALINDROME WITHOUT STRING
#include<stdio.h>
int main()
{
char string[40];
int length=0, flag=1,i;
printf("Enter string:n");
scanf("%s",string);
for(i=0;string[i]!=' ';i++)
{
length++;
}
for(i=0;i<length/2;i++)
{
if( string[i] != string[length-1-i] )
{
flag=0;
break;
}
}
if(flag==1)
{
printf("PALINDROME");
}
else
{
printf("NOT PALINDROME");
}
return 0;
}
STRING CONCATENATION WITH OUT STRING FUNC
#include <stdio.h>
int main()
{
char str1[50], str2[50], i, j;
printf("nEnter first string: ");
scanf("%s",str1);
printf("nEnter second string: ");
scanf("%s",str2);
for(i=0; str1[i]!=' '; i++);
for(j=0; str2[j]!=' '; j++, i++)
{
str1[i]=str2[j];
}
str1[i]=' ';
printf("n Concatenated String is: %s",str1);
return 0;
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team