Program to Find the Prime Index elements Prime index sum Duplicate Elements Removal Occurence of the Elements copy an array Element That has occurred Maximum in an Array Using C Programming
#include<stdio.h>
int main()
{
int n;
int a[100];
int i;
int j;
int temp=0;
int max=0;
int min=0;
int tempa[100];
int dup[100];
int idx=0;
int k;
int dn=0;
int count=0;
int prime[100];
int pidx=0;
int flag=0;
int primesum=0;
int maxoc=0;
int maxoel=0;
scanf("%d",&n);
printf("getting inputs \n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("Elements in the array\n ");
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
printf("\ncopy elements fom one array to another\n");
for(i=0;i<n;i++)
{
tempa[i]=a[i];
}
for(i=0;i<n;i++)
{
printf("%d ",tempa[i]);
}
printf("\n prime index elements and prime index sum\n");
for(i=0;i<n;i++)
{
flag=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
{
flag++;
}
}
if(flag==2)
{
primesum=primesum+tempa[i];
prime[pidx]=tempa[i];
pidx++;
}
}
for(i=0;i<pidx;i++)
{
printf("%d ",prime[i]);
}
printf("\nprime index sum : %d",primesum) ;
printf("\nSorting the elements \n");
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
printf("\nMaximum and minimum\n");
max=a[n-1];
min=a[0];
printf("max : %d min : %d",max,min);
printf("\n descending order\n");
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]<=max)
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
}
}
for(i=0;i<n;i++)
{
printf("%d ",a[i]);
}
printf("\nremove duplicate and occurrence \n");
for(i=0;i<n;i++)
{
count=1;
for(j=i+1;j<n;)
{
if(a[i]==a[j])
{
count++;
for(k=j;k<n;k++)
{
a[k]=a[k+1];
}
n--;
dn=n;
}
else
{
j++;
}
}
dup[idx]=a[i];
dup[idx+1]=count;
idx=idx+2;
}
printf("occurrence of an element\n");
for(i=0;i<idx;i++)
{
printf("%d ",dup[i]);
}
printf("\nremoved duplicates\n");
for(i=0;i<dn;i++)
{
printf("%d ",a[i]);
}
printf("\nmaximum repeated element\n");
for(i=1;i<idx;i=i+2)
{
if(dup[i]>maxoc)
{
maxoc=dup[i];
maxoel=i;
}
}
printf("maximum count occured: %d\n",maxoc);
printf("maximum times occured element : %d",dup[maxoel-1]);
return 0;
}
output
-------
10
getting inputs
1 2 3 1 1 1 2 2 4 5
Elements in the array
1 2 3 1 1 1 2 2 4 5
copy elements fom one array to another
1 2 3 1 1 1 2 2 4 5
prime index elements and prime index sum
3 1 1 2
prime index sum : 7
Sorting the elements
1 1 1 1 2 2 2 3 4 5
Maximum and minumum
max : 5 min : 1
descending order
5 4 3 2 2 2 1 1 1 1
remove duplicate and occurence
occurence of an element
5 1 4 1 3 1 2 3 1 4
removed duplicates
5 4 3 2 1
maximum repeated element
maximum count : 4
maximum count element : 1
ReplyDelete•★COMPOSITE HACKS ★•
Are You Seeking For A LEGIT PROFESSIONAL HACKER Who Will Get Your Job Done Efficiently With Swift Response?? CONGRATULATIONS, Your Search Ends Right Here.
★ WHO ARE COMPOSITE HACKS ???
• We are a Team Of Professional HACKERS , a product of the coming together of Legit Hackers from the Dark-Web (pentaguard, CyberBerkut, White Hack and Black Hat,) we have been existing for over years, our system is a very strong and decentralized command structure that operates on ideas and directives.
★ JOB GUARANTEE:
Whenever We Are been hired as a Team Hackers We typically only take jobs that We find somehow original, challenging, or especially helpful to the community. We’ve never wanted to sit around defending some video game company’s source code from network intruders – We prefer to help nonprofits, private investigators, Private Individuals, government contractors, and other traditionally underserved populations.
And We’d rather match skills against the best in the field of state-sponsored hackers engaged in economic espionage than put some kid in prison for pranking the phone company. When a company tries to hire Us, the first question I ask is: “Who is this going to help?”
I know COMPOSITE HACKS is Well known for LEGIT HACKING SERVICES, but i always try to avoid people thinking We’r proud or making Many individual think its only the big companies that can hire Us, fine, here is Our mail: “””compositehacks@cyberservices.com””” You Can Reach Out To Us for Your Desired HACKING Services Ranging from:
* Penetration Testing
* Jail Breaking
* PHONE HACKING (Which gives you Unnoticeable Access to Everything that is Happening on the phone such as call logs, messages, chats and all social media Apps .
* Retrieval Of Lost Files
* Location Tracking.
* Clearing Of Criminal Records.
* Hacking Of Server, Database And Social Media accounts e.g Facebook, twitter, Instagram Snapchat etc
★ SOME SPECIAL SERVICES WE OFFER:
* RECOVERY OF LOST FUNDS ON BINARY OPTIONS.
* Bank Accounts Loading ( Only USA Banks)
* Credit Cards Loading (Only USA CC’s)’
★Our Team houses a separate group of specialists who are productively focussed and established authorities in different platforms. They hail from a proven track record Called “HackerOne” and have cracked even the toughest of barriers to intrude and capture or recapture all relevant data needed by our Clients. Some Of These Specialist Includes PETER YAWORSKI, FRANS ROSEN, JACK CABLE, JOBERT ABMA, ARNE SWINNEN And More
★COMPOSITE HACKS is available for customer care 24/7, all day and night. We understand that your request might be urgent, so we have a separate team of allocated hackers who interact with our Clients round the clock. You are with the right people so just get started.
★CONTACT:
* Email:
compositehacks@cyberservices.com
compositehacks@gmail.com
* Wickr: compositehacks
★CONTACT US AND GET YOUR PROBLEMS SOLVED IN THE TWINKLING OF AN EYE
★
Great Article, I appreciate your effort in putting up this. We will love to let you know that there are available Post UTME past questions and answers.
ReplyDeleteYou finished certain solid focuses there. I did a pursuit regarding the matter and discovered almost all people will concur with your blog.
ReplyDeleteiot course in noida
I feel extremely glad to have seen your site page and anticipate such a large number of additionally engaging occasions perusing here. Much obliged again for all the subtleties.
ReplyDelete360DigiTMG
Going to graduate school was a positive decision for me. I enjoyed the coursework, the presentations, the fellow students, and the professors. And since my company reimbursed 100% of the tuition, the only cost that I had to pay on my own was for books and supplies. Otherwise, I received a free master’s degree. All that I had to invest was my time.
ReplyDeleteBest Digital Marketing Courses in Hyderabad
훌륭한 게시물, 당신은 몇 가지 환상적인 포인트를 지적했습니다. 나는 마찬가지로 이것이 매우 멋진 웹 사이트라고 생각합니다. 먹튀검증
ReplyDeleteReally appreciate this wonderful post that you have provided for us.Great site and a great topic as well i really get amazed to read this. Its really good 먹튀폴리스
ReplyDeletePretty nice post. I just stumbled upon your weblog and wanted to say that I have really enjoyed browsing your blog posts. After all I’ll be subscribing to your feed and I hope you write again soon해선사이트
ReplyDeleteتصميم المواقع أفضل الممارسات التي يقوم بها أصحاب الأعمال اليوم يمكنك الأن
ReplyDeleteتصميم مواقع
تصميم متجر الكتروني
ReplyDeleteبرنامج إدارة الموارد البشرية
سعر برنامج حسابات
برنامج محاسبة
الحسابات الختامية
الميزانية العمومية
I am impressed by the information that you have on this blog. It shows how well you understand this subject.
ReplyDeletedata scientist certification malaysia
Sign up now and participate in our demonstration sessions for Python Course in Hyderabad by AI Patasala and nurture your career with this platform.
ReplyDeletePython Certification in Hyderabad
Fast-track your data analytics and machine learning course with guaranteed placement opportunities. Most extensive, industry-approved experiential learning program ideal for future Data Scientists.
ReplyDelete