Wednesday, June 16, 2021

Troubler Ascender

 // To arrange entered numbers in ascending order

#include <stdio.h>

void swapper(int*,int*);

void ascender(int,int[]);

int main()

{ int i,values[6];

printf("Enter 5 numbers");

for(i=1;i<=5;i++){ scanf("%d",&values[i]);}

ascender(i,&values[0]);

printf("The ascending order of the numbers is");

for(i=1;i<=5;i++){ printf("%d ",values[i]);}}

void ascender(int i, int* values){

int j=0;

for (i=1;i<=4;i++){ 

for(j=1;j<=4;j++){

if (values[j+1]< values[j]){  swapper( &values[j],&values[j+1]); }}}}

void swapper(int *a,int *b){

int temp; temp=*b; *b=*a ; *a=temp;}











No comments:

Post a Comment

Meet links

 Section 11A meet.google.com/edcdmynkjh Section 11 B meet.google.com/tapmhdtkfj Section 11C meet.google.com/sxajjevufp Section !!D meet.goog...