Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
/**Bismillahir Rahmanir Rahim.**/ #include <stdio.h> int main() { int x=0,a,b,c,e,d=0; for(a=1;a<=100;a++) { scanf("%d", &b); x++; if(b>d) { e=x; d=b; } } printf("%d\n",d); printf("%d\n",e); return 0; }
what is the function of writing x=0 and d=0?
ReplyDeleteInitially x and d has a value.
DeleteI need to make sure that there value is zero for the purpose of calculation.
if(b>d)
ReplyDelete{
d=b;}
why???and how???
for swaping
ReplyDeletecan i do it in selection sort mathod?
ReplyDelete#include
int main()
{
int a[100],i,k,j;
for(i=0;i<100;i++)
{
scanf("%d",&a[i]);
}
k=a[0];
j=1;
for(i=1;i<99;i++)
{
if(k<a[i])
{
k=a[i];
j=i+1;
}
}
printf("%d\n%d\n",k,j);
return 0;
}
what is wrong with it?(50% error)
#include
Deleteint main()
{
int a[1000],i,max,b=0;
max=a[0];
for(i=0;i<100;i++){
scanf("%d",&a[i]);
if(max<a[i])
max=a[i];
b=a[i]+1;
}
printf("%d\n",max);
printf("%d\n",b+1);
return 0;
}
what is wrong with it ?
25% error
How position is stored ?? please explain its algorithm.
ReplyDeleteI´m really impressed! It helped me a lot! Your solution is short and pretty understandable!!
ReplyDelete#include
ReplyDeleteint main()
{
int a[1000],i,max,b=0;
max=a[0];
for(i=0;i<100;i++){
scanf("%d",&a[i]);
if(max<a[i])
max=a[i];
b=a[i]+1;
}
printf("%d\n",max);
printf("%d\n",b+1);
return 0;
}
why 25% error that one
!!!!!!!!!!!!!!!!!!
#include
ReplyDeleteint main()
{
int a[100],i,max,b=0,c;
max=a[0];
for(i=0;i<10;i++){
scanf("%d",&a[i]);
b++;
if(max<a[i]){
max=a[i];
c=b;
}
}
printf("%d\n",max);
printf("%d\n",c);
return 0;
}
100% right ans
boss raheeeeeeeeeeeeeeeeeeeeee