All C and C++ Question and Solution from Previous Exam paper

C, C++, etc Programing examples. Post as many you can. Test the programs and discuss about the output of the programes.
Forum rules
Please Discuss & post only about the programes and its Output

All C and C++ Question and Solution from Previous Exam paper

Postby irfanmasiullah » Fri Apr 16, 2010 1:37 pm

Hello Friends.

As Sum 2010 is now near, lets solve the C and C++ Exam's Question here.
Others must contribute and comments, how many marks can get.
Thanks & Best Regards -
Irfan M Ansari - Section B - Civil
MOB- 00966 561 770 321 - Dammam - Saudi Arabia
Email :irfanmasiullah@gmail.com
IM: irfanmasiullah@yahoo.com : irfanmasiullah@gmail.com
User avatar
irfanmasiullah
Super Member
Super Member
 
Posts: 77
Joined: Thu Jul 30, 2009 7:59 pm
Location: Mumbai / Dammam (Saudi Arabia)
membership: Senior Technician of The Institution of Engineers (India)- ST

ad
 

Re: All C and C++ Question and Solution from Previous Exam paper

Postby irfanmasiullah » Fri Apr 16, 2010 1:46 pm

I am starting myself to start the solution.

Sum2005- Q.1.C.
write a C program that will accept an integer N as input if and only if that integar.
* summer 2005- Q1.c*/
#include <stdio.h>
#include <conio.h>
int main ()
{
int N;
int n; int i=0;
printf ("Please Enter the value between 0-9999:");
scanf ("%d", &N);
if (N<=9999)
{
while (N!=0)
{n=N%10;
N=N/10;
i=i+n;}
printf ("Summation of given number is %d", i);
}
else
{printf ("Given number is not in Limit");}
getch ;

}
Thanks & Best Regards -
Irfan M Ansari - Section B - Civil
MOB- 00966 561 770 321 - Dammam - Saudi Arabia
Email :irfanmasiullah@gmail.com
IM: irfanmasiullah@yahoo.com : irfanmasiullah@gmail.com
User avatar
irfanmasiullah
Super Member
Super Member
 
Posts: 77
Joined: Thu Jul 30, 2009 7:59 pm
Location: Mumbai / Dammam (Saudi Arabia)
membership: Senior Technician of The Institution of Engineers (India)- ST

Re: All C and C++ Question and Solution from Previous Exam paper

Postby irfanmasiullah » Fri Apr 16, 2010 1:49 pm

I will appreciate the Comments as well as marks on above solution from SKYBLUE and Praveen as they are senior member, I feel.

Regards
irfan
Thanks & Best Regards -
Irfan M Ansari - Section B - Civil
MOB- 00966 561 770 321 - Dammam - Saudi Arabia
Email :irfanmasiullah@gmail.com
IM: irfanmasiullah@yahoo.com : irfanmasiullah@gmail.com
User avatar
irfanmasiullah
Super Member
Super Member
 
Posts: 77
Joined: Thu Jul 30, 2009 7:59 pm
Location: Mumbai / Dammam (Saudi Arabia)
membership: Senior Technician of The Institution of Engineers (India)- ST

Re: All C and C++ Question and Solution from Previous Exam paper

Postby irfanmasiullah » Fri Apr 16, 2010 9:36 pm

Hello Friends

Lets solve this..(Sum05-Q3.C)
write c function that will compute the K in largest and K in Smallest element along with their postions in an array of signed integars. assume the following.
5 <=N <=50 and a<=K<=N.
Thanks & Best Regards -
Irfan M Ansari - Section B - Civil
MOB- 00966 561 770 321 - Dammam - Saudi Arabia
Email :irfanmasiullah@gmail.com
IM: irfanmasiullah@yahoo.com : irfanmasiullah@gmail.com
User avatar
irfanmasiullah
Super Member
Super Member
 
Posts: 77
Joined: Thu Jul 30, 2009 7:59 pm
Location: Mumbai / Dammam (Saudi Arabia)
membership: Senior Technician of The Institution of Engineers (India)- ST


Return to Computer Notes : Some Sample Programs

Who is online

Users browsing this forum: No registered users and 0 guests