Hi friends,Here I'm posting some important concepts asked in CUSAT B Tech S1 S2 C programming examination. All the concepts are descried here in very briefly so that you can grasp it quickly.Here we go..!!! :)Pointer · Pointer is a variable that represents the location of a data item. · Address operator (&) : It evaluates the address of its operand. · Indirection Operator(*): Used to access data item referenced by a pointer. Example: Main() { Int a=3; Int *ptr; Ptr=&a; Printf(“%d %u” , *ptr, ptr); } Pointer to an array · A pointer can be used to reference an array. · The name...
Showing posts with label Cusat. Show all posts
Showing posts with label Cusat. Show all posts
Tuesday, June 19
Thursday, May 31
SELECTION SORT ~ CUSAT Previous Questions with Answers- C programming.( S1 S2)
v!p!n
2
comments
Hi friends,
Here I'm posting a C program implementing Selection sort. It is specially dedicated to S1 S2 B tech students because Selection sort is one of the most frequently asking questions in "Computer Programming" exams. Hope this will be Useful 4 you.!!! :)
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int n,i,j,temp,a[50];
printf("\nEnter how many elements=");
scanf("%d",&n);
printf("\nEnter %d elements",n);// Input the elements
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n-1;i++)// Sorting the elements
{
for(j=i+1;j<n;j++)
{
if(a[i]>a[j])
{
temp=a[j];
a[j]=a[i];
a[i]=temp;
}
}
}
printf("\nSorted...
Monday, May 28
CUSAT Previous Questions with Answers- C programming.( S1 S2)
v!p!n
1 comment
Hi Friends,
here I'm posting one of the frequently asking question in CUSAT B tech C programming ( s 1 s2 ) and its solution:
Question:
Write a C program which prints all Armstrong numbers between 1 and 1000.
Solution:
#include<stdio.h>
main()
{
int number, temp, digit=0, dup;
printf("Printing all Armstrong numbers between 1 and 500:\n\n");
number = 1;
while (number <= 500)
{
temp=0;
dup=number;
while(dup>0)
{
digit=dup%10;
temp+=(digit*digit*digit);
dup=dup/10;
}
if (temp==number)
{
printf("\nAmstrong Number:%d", temp);
}
number++;
}
getch();
}
&nbs...