•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 428,201 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,224 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser: Programming Forums
Views: 521 | Replies: 8 | Solved
•
•
Join Date: Aug 2007
Posts: 20
Reputation:
Rep Power: 0
Solved Threads: 0
#include<stdio.h>
int main()
{
int i ,j ,a[5];
for(i=0;i<=4;i++)
{
printf("\n\tEnter the %dst value of the array: ", i+1);
scanf("%d", &a[i]);
}
j = a[0];
printf("\n\tOriginal array entered by the user: ");
for(i=0;i<=4;i++)
{
printf(" %d ", a[i]);
if(a[i]<a[i+1])
{
j = a[i+1];
}
}
printf("\n\n\tGreatest no. from the array: %d", j);
getch();
return 0;
}according to me there is no problem in this code.......
but its printing some wierd values again n again.....
plz...help me out here....
My Wierd Output:
Enter the 1st value of the array: 56
Enter the 2st value of the array: 35
Enter the 3st value of the array: 26
Enter the 4st value of the array: 15
Enter the 5st value of the array: 24
Original array entered by the user: 56 35 26 15 24
Greatest no. from the array: 4007048
Last edited by web_master : May 9th, 2008 at 2:17 pm.
•
•
•
•
•
•
•
•
DaniWeb C Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the C Forum
- Previous Thread: Hiding Invisible charactors in Visual Studio 2005
- Next Thread: Help with doing loops



Threaded Mode